Page MenuHomePhabricator

D19353.id46303.diff
No OneTemporary

D19353.id46303.diff

diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -648,10 +648,17 @@
// just bail out.
throw $status;
} else {
- // This is HTTP 2XX, so use the response body to save the
- // file data.
+ // This is HTTP 2XX, so use the response body to save the file data.
+ // Provide a default name based on the URI, truncating it if the URI
+ // is exceptionally long.
+
+ $default_name = basename($uri);
+ $default_name = id(new PhutilUTF8StringTruncator())
+ ->setMaximumBytes(64)
+ ->truncateString($default_name);
+
$params = $params + array(
- 'name' => basename($uri),
+ 'name' => $default_name,
);
return self::newFromFileData($body, $params);

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 7:08 AM (4 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715133
Default Alt Text
D19353.id46303.diff (997 B)

Event Timeline