-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEB-2393] chore-Uploading svg's are no more supported in the platform #5646
Conversation
WalkthroughThe pull request introduces changes to the image upload functionality across three components: Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- web/core/components/core/image-picker-popover.tsx (2 hunks)
- web/core/components/core/modals/user-image-upload-modal.tsx (2 hunks)
- web/core/components/core/modals/workspace-image-upload-modal.tsx (3 hunks)
Additional comments not posted (6)
web/core/components/core/modals/user-image-upload-modal.tsx (2)
42-43
: Verify the impact on user experience and documentation.The changes to the
accept
property in theuseDropzone
configuration align with the PR objective to limit the allowed image upload types. Removing support for ".svg" and ".webp" formats is consistent with the issue tracked under WEB-2393.Please ensure that:
- The impact on user experience, especially for users who previously uploaded ".svg" or ".webp" images, is considered and addressed if necessary.
- Any user-facing documentation or guides that mention the supported image formats are updated to reflect this change.
160-160
: LGTM!The updated user-facing text accurately informs users about the supported image formats (".jpeg", ".jpg", and ".png"). This change is consistent with the modifications made to the
accept
property in theuseDropzone
configuration and ensures that the displayed information aligns with the new restrictions on file uploads.web/core/components/core/modals/workspace-image-upload-modal.tsx (2)
154-154
: LGTM!The reformatting of the
input
element's props improves code consistency and readability without affecting functionality.
166-166
: LGTM!Updating the user interface text to reflect the new file format restrictions maintains consistency and sets the right expectations for users.
web/core/components/core/image-picker-popover.tsx (2)
92-93
: LGTM!The changes to the
useDropzone
configuration correctly restrict the accepted image formats to JPEG and PNG only, aligning with the PR objective.
359-359
: LGTM!The user-facing text has been appropriately updated to list only the supported file formats of
.jpeg
,.jpg
, and.png
, providing clarity to the users.
"image/jpeg": [], | ||
"image/png": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Inconsistency found in WEBP support across components
The change to restrict image uploads to JPEG and PNG formats in workspace-image-upload-modal.tsx
is inconsistent with the file validation logic in other parts of the codebase. Specifically:
- In
packages/editor/src/core/plugins/image/utils/validate-file.ts
, WEBP is still listed as an allowed file type.
To ensure consistency and prevent potential bugs:
- Update
validate-file.ts
to remove WEBP from the list of allowed types. - Review other components that handle image uploads or processing to ensure they align with the new JPEG and PNG only restriction.
- Consider updating user-facing documentation to reflect the change in supported image formats.
Analysis chain
Verify the impact of restricting image upload formats.
The change to limit the accept
property to only "image/jpeg"
and "image/png"
aligns with the PR objective. However, please consider the following:
- Ensure that removing support for other image formats like SVG and WEBP does not break any existing functionality in the codebase.
- Consider updating the user-facing documentation or in-app messaging to clearly communicate the new file format restrictions to users.
Run the following script to verify references to other image formats in the codebase:
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify references to image formats other than JPEG and PNG.
# Test: Search for references to SVG. Expect: No results.
rg --type typescript $'image/svg'
# Test: Search for references to WEBP. Expect: No results.
rg --type typescript $'image/webp'
Length of output: 136
Script:
#!/bin/bash
# Description: Verify references to image formats other than JPEG and PNG in TypeScript files.
# Search for references to SVG and WEBP in .ts and .tsx files
rg -i -C 2 -g '*.{ts,tsx}' 'image/(svg|webp)'
Length of output: 1334
Clean Reason
Updated allowed image upload type. Removed .webp image upload and updated the accepting function to only allow jpg's and png.
Implementation
References
[WEB-2393]
Summary by CodeRabbit
New Features
.jpeg
,.jpg
, and.png
.Bug Fixes