fix: allow files with # to be uploaded, show upload confirmation#3664
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
client/utils/upload.ts:77
- Only
rawFileNameis sanitized, butfileExtensioncan still contain URL-reserved characters (e.g.image.jpg#2yieldsfileExtension === "jpg#2"). That reintroduces the same#/fragment issue in both the S3 key and verification/download URLs. Consider sanitizing the extension (or encoding the URL when verifying/downloading).
const fileName = rawFileName.replace(/[^a-zA-Z0-9\-_.]+/g, '_');
const random = Math.floor(Math.random() * 8);
const now = new Date().getTime();
const pubSegment = pubId ? `/p${pubId}` : '';
return `${testPrefix}c${communityId}${pubSegment}/u${userId}/${fileName}-${random}${now}.${fileExtension}`;
Comment on lines
31
to
+35
| if (files.length) { | ||
| s3Upload(files[0], this.onUploadProgress, this.onUploadFinish, 0); | ||
| s3Upload(files[0], this.onUploadProgress, this.onUploadFinish, 0, this.onUploadError); | ||
| this.setState({ | ||
| isUploading: true, | ||
| progress: 0, |
Comment on lines
31
to
+35
| if (files.length) { | ||
| s3Upload(files[0], this.onUploadProgress, this.onUploadFinish, 0); | ||
| s3Upload(files[0], this.onUploadProgress, this.onUploadFinish, 0, this.onUploadError); | ||
| this.setState({ | ||
| isUploading: true, | ||
| progress: 0, |
Comment on lines
+35
to
+39
| s3Upload(files[0], this.onUploadProgress, this.onUploadFinish, 0, this.onUploadError); | ||
| this.setState({ | ||
| isUploading: true, | ||
| progress: 0, | ||
| uploadError: null, |
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.
Issue(s) Resolved
Files with a # in their name couldnt be uploaded.
Also when you uploaded a file during the submission workflow it wouldnt show confirmation you succeeded.
Test Plan
Screenshots (if applicable)
Optional
Notes/Context/Gotchas
Supporting Docs