Page MenuHomePhabricator

When creating a file by downloading a URI, truncate the length of the default name
ClosedPublic

Authored by epriestley on Apr 12 2018, 6:14 PM.
Tags
None
Referenced Files
F18509561: D19353.id.diff
Fri, Sep 5, 3:28 AM
F18502680: D19353.diff
Thu, Sep 4, 10:35 PM
F18220702: D19353.id46301.diff
Tue, Aug 19, 3:39 PM
F18199939: D19353.id.diff
Mon, Aug 18, 2:58 AM
F18193922: D19353.diff
Sun, Aug 17, 7:29 AM
F18084413: D19353.id46303.diff
Aug 5 2025, 3:21 PM
F17920243: D19353.id46301.diff
Jul 30 2025, 3:31 AM
Unknown Object (File)
Jun 2 2025, 1:33 PM
Subscribers
None

Details

Summary

See https://discourse.phabricator-community.org/t/embedding-external-images-url-show-error-for-long-urls/1339.

When we download a file from a URI, we provide a default name based on the URI. However, if the URI is something like http://example.com/very-very-very-....-long.jpg with more than 255 characters, we may suggest a name which won't fit into the name column of PhabricatorFile.

Instead, suggest a default name no longer than 64 bytes.

Test Plan
  • Used the {image ...} example from the Discourse report locally; got an image with a truncated name.
  • Used a normal {image ...}, got an image file with a normal name.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable