Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14476229
D12255.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12255.diff
View Options
diff --git a/scripts/mail/mail_handler.php b/scripts/mail/mail_handler.php
--- a/scripts/mail/mail_handler.php
+++ b/scripts/mail/mail_handler.php
@@ -77,6 +77,7 @@
$attachment->getContent(),
array(
'name' => $attachment->getFilename(),
+ 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
));
$attachments[] = $file->getPHID();
}
diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php
--- a/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php
+++ b/src/applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php
@@ -56,7 +56,7 @@
$file = PhabricatorFile::newFromPHPUpload(
$file_raw,
array(
- 'authorPHID' => $user->getPHID(),
+ 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
));
$file_phids[] = $file->getPHID();
} catch (Exception $ex) {
diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php
--- a/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php
+++ b/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php
@@ -42,7 +42,7 @@
$file = PhabricatorFile::newFromPHPUpload(
$file_raw,
array(
- 'authorPHID' => $user->getPHID(),
+ 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
));
$file_phids[] = $file->getPHID();
} catch (Exception $ex) {
diff --git a/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php b/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
--- a/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
+++ b/src/applications/metamta/replyhandler/PhabricatorMailReplyHandler.php
@@ -327,11 +327,8 @@
return $body;
}
- // NOTE: This is safe, but not entirely correct. Clean it up after
- // T7712. These files have the install-default policy right now, which
- // may or may not be permissive.
$files = id(new PhabricatorFileQuery())
- ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->setViewer($this->getActor())
->withPHIDs($attachments)
->execute();
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
@@ -121,6 +121,19 @@
$this->setAuthorPHID($sender->getPHID());
+ // Now that we've identified the sender, mark them as the author of
+ // any attached files.
+ $attachments = $this->getAttachments();
+ if ($attachments) {
+ $files = id(new PhabricatorFileQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withPHIDs($attachments)
+ ->execute();
+ foreach ($files as $file) {
+ $file->setAuthorPHID($sender->getPHID())->save();
+ }
+ }
+
$receiver->receiveMail($this, $sender);
} catch (PhabricatorMetaMTAReceivedMailProcessingException $ex) {
switch ($ex->getStatusCode()) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 29, 1:34 AM (8 h, 23 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6941463
Default Alt Text
D12255.diff (3 KB)
Attached To
Mode
D12255: Make file policies for emailed files more consistent
Attached
Detach File
Event Timeline
Log In to Comment