Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2685844
D25113.1734705393.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25113.1734705393.diff
View Options
diff --git a/src/aphront/response/AphrontFileResponse.php b/src/aphront/response/AphrontFileResponse.php
--- a/src/aphront/response/AphrontFileResponse.php
+++ b/src/aphront/response/AphrontFileResponse.php
@@ -8,7 +8,14 @@
private $compressResponse;
private $mimeType;
+
+ /**
+ * Download filename
+ *
+ * This is NULL as default or a string.
+ */
private $download;
+
private $rangeMin;
private $rangeMax;
private $allowOrigins = array();
@@ -18,14 +25,30 @@
return $this;
}
+ /**
+ * Set a download filename
+ *
+ * @param $download string
+ * @return self
+ */
public function setDownload($download) {
+
+ // Make sure we have a populated string
if (!phutil_nonempty_string($download)) {
- $download = 'untitled';
+ $download = 'untitled';
}
+
$this->download = $download;
return $this;
}
+ /**
+ * Get the download filename
+ *
+ * If this was never set, NULL is given.
+ *
+ * @return string
+ */
public function getDownload() {
return $this->download;
}
@@ -113,7 +136,7 @@
$headers[] = array('Content-Length', $content_len);
}
- if (strlen($this->getDownload())) {
+ if (phutil_nonempty_string($this->getDownload())) {
$headers[] = array('X-Download-Options', 'noopen');
$filename = $this->getDownload();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 14:36 (21 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1018764
Default Alt Text
D25113.1734705393.diff (1 KB)
Attached To
Mode
D25113: AphrontFileResponse: avoid alien usages of setDownload()
Attached
Detach File
Event Timeline
Log In to Comment