Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15415639
D19353.id46303.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
997 B
Referenced Files
None
Subscribers
None
D19353.id46303.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D19353: When creating a file by downloading a URI, truncate the length of the default name
Attached
Detach File
Event Timeline
Log In to Comment