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
Unknown Object (File)
Mon, Jun 2, 1:33 PM
Unknown Object (File)
May 26 2025, 10:38 PM
Unknown Object (File)
May 19 2025, 3:17 AM
Unknown Object (File)
May 18 2025, 9:15 AM
Unknown Object (File)
May 3 2025, 10:03 AM
Unknown Object (File)
Apr 22 2025, 1:21 AM
Unknown Object (File)
Apr 17 2025, 12:16 AM
Unknown Object (File)
Apr 15 2025, 3:06 AM
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