Weblab replace unsafe chars in uploaded image filenames #29245
Merged
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.
Background
Follow-on to #29222 . Finishes https://codedotorg.atlassian.net/browse/LP-438, for now. Also finishes https://codedotorg.atlassian.net/browse/STAR-480.
Description
When uploading images in weblab, replace any unsafe characters with dashes. This is a partial fix to a broader issue. This approach is relatively safe and self-contained, because the browser relies on the POST response to know what the filename is, so it doesn't have much chance to accidentally use the original, unsafe filename.
Caveats
This doesn't stop you from naming HTML files, or renaming image files, to contain unsafe characters via the weblab UI. That work is tracked by https://codedotorg.atlassian.net/browse/STAR-481
Screenshots
before/after screenshots in the asset manager are identical to #29222 . screenshots from within weblab are similar:
before
after