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
F18833326: D19353.id.diff
Sun, Oct 26, 2:35 AM
F18830542: D19353.diff
Sat, Oct 25, 7:22 AM
F18812670: D19353.id.diff
Mon, Oct 20, 11:27 AM
F18765604: D19353.diff
Tue, Oct 7, 12:04 PM
F18651774: D19353.id46301.diff
Sep 21 2025, 5:25 AM
F18569233: D19353.diff
Sep 10 2025, 1:07 AM
F18509561: D19353.id.diff
Sep 5 2025, 3:28 AM
F18502680: D19353.diff
Sep 4 2025, 10:35 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