Repository navigation
Separate the content hash in uploaded filenames - #382
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #356.
Reproduction
On the published 3.2.5 ZIP with PrestaShop 9.1.4, upload
my-image-1200.pngthrough the authenticated PrettyBlocks file upload endpoint. The stored and returned name ismy-image-1200<md5>.png: PrestaShop's URL sanitizer removes the underscore before the hash.Change
Sanitize the original stem first, then append a hyphen, the full content hash, and the extension. Truncate only the stem to fit 255 bytes without cutting a UTF-8 character or losing the hash. This keeps distinct uploads from sharing a filename even when the original name is long. Existing uploads and stored URLs are not renamed or migrated.
Thanks to @Daaaaad for the detailed report.
Validation
30806d5292e2ed825ecfa21bfc739524e5f0b753d0396fec3789d322b382cd8d) and installed that exact ZIP on PS 8.2.7/PHP 8.1.33 and PS 9.1.4/PHP 8.5.0. Manifest, assets and smoke tests pass on both.git diff --checkpass. No merge conflicts found with Disable sorting on PrettyBlocks action columns #380 or Prevent stale saves from restoring deleted repeater items #381 in the local merge simulations.No version bump, schema change, or release.