@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't dead-end users with out-of-date links to files

Summary: Ref T10262. Instead of dumping an unhelpful 403 "ACCESS DENIED" page on users, explain the most likely cause of the issue and give them a link to return to the file detail page to learn more or get an up-to-date link.

Test Plan: Hit both errors, had a lovely experience with the helpful dialog text.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10262

Differential Revision: https://secure.phabricator.com/D15650

+31 -7
+31 -7
src/applications/files/controller/PhabricatorFileDataController.php
··· 119 119 return new Aphront404Response(); 120 120 } 121 121 122 + // We may be on the CDN domain, so we need to use a fully-qualified URI 123 + // here to make sure we end up back on the main domain. 124 + $info_uri = PhabricatorEnv::getURI($file->getInfoURI()); 125 + 126 + 122 127 if (!$file->validateSecretKey($this->key)) { 123 - return new Aphront403Response(); 128 + $dialog = $this->newDialog() 129 + ->setTitle(pht('Invalid Authorization')) 130 + ->appendParagraph( 131 + pht( 132 + 'The link you followed to access this file is no longer '. 133 + 'valid. The visibility of the file may have changed after '. 134 + 'the link was generated.')) 135 + ->appendParagraph( 136 + pht( 137 + 'You can continue to the file detail page to get more '. 138 + 'information and attempt to access the file.')) 139 + ->addCancelButton($info_uri, pht('Continue')); 140 + 141 + return id(new AphrontDialogResponse()) 142 + ->setDialog($dialog) 143 + ->setHTTPResponseCode(404); 124 144 } 125 145 126 146 if ($file->getIsPartial()) { 127 - // We may be on the CDN domain, so we need to use a fully-qualified URI 128 - // here to make sure we end up back on the main domain. 129 - $info_uri = PhabricatorEnv::getURI($file->getInfoURI()); 130 - 131 - return $this->newDialog() 147 + $dialog = $this->newDialog() 132 148 ->setTitle(pht('Partial Upload')) 133 149 ->appendParagraph( 134 150 pht( 135 151 'This file has only been partially uploaded. It must be '. 136 152 'uploaded completely before you can download it.')) 137 - ->addCancelButton($info_uri); 153 + ->appendParagraph( 154 + pht( 155 + 'You can continue to the file detail page to monitor the '. 156 + 'upload progress of the file.')) 157 + ->addCancelButton($info_uri, pht('Continue')); 158 + 159 + return id(new AphrontDialogResponse()) 160 + ->setDialog($dialog) 161 + ->setHTTPResponseCode(404); 138 162 } 139 163 140 164 $this->file = $file;