Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13987078
D11915.id28703.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11915.id28703.diff
View Options
diff --git a/src/applications/files/controller/PhabricatorFileDataController.php b/src/applications/files/controller/PhabricatorFileDataController.php
--- a/src/applications/files/controller/PhabricatorFileDataController.php
+++ b/src/applications/files/controller/PhabricatorFileDataController.php
@@ -73,9 +73,13 @@
// if the user can see the file, generate a token;
// redirect to the alt domain with the token;
+ $token_uri = $file->getCDNURIWithToken();
+ $token_uri = new PhutilURI($token_uri);
+ $token_uri = $this->addURIParameters($token_uri);
+
return id(new AphrontRedirectResponse())
->setIsExternal(true)
- ->setURI($file->getCDNURIWithToken());
+ ->setURI($token_uri);
} else {
// We are using the alternate domain
@@ -93,7 +97,7 @@
$acquire_token_uri = id(new PhutilURI($file->getViewURI()))
->setDomain($main_domain);
-
+ $acquire_token_uri = $this->addURIParameters($acquire_token_uri);
if ($this->token) {
// validate the token, if it is valid, continue
@@ -186,4 +190,19 @@
return $response;
}
+
+ /**
+ * Add passthrough parameters to the URI so they aren't lost when we
+ * redirect to acquire tokens.
+ */
+ private function addURIParameters(PhutilURI $uri) {
+ $request = $this->getRequest();
+
+ if ($request->getBool('download')) {
+ $uri->setQueryParam('download', 1);
+ }
+
+ return $uri;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 7:20 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710509
Default Alt Text
D11915.id28703.diff (1 KB)
Attached To
Mode
D11915: When redirecting to acquire file access tokens, retain 'download' parameter
Attached
Detach File
Event Timeline
Log In to Comment