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)
Wed, Nov 20, 9:58 PM
Unknown Object (File)
Wed, Nov 20, 9:46 PM
Unknown Object (File)
Mon, Nov 18, 5:40 AM
Unknown Object (File)
Wed, Nov 13, 4:57 PM
Unknown Object (File)
Sun, Nov 10, 6:47 AM
Unknown Object (File)
Tue, Nov 5, 10:53 PM
Unknown Object (File)
Oct 3 2024, 3:41 PM
Unknown Object (File)
Sep 5 2024, 2:45 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