-
Notifications
You must be signed in to change notification settings - Fork 166
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
fix: check image size limit #251
Conversation
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe pull request introduces a new boolean parameter Changes
Possibly related PRs
Poem
🪧 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
🧹 Nitpick comments (2)
.github/workflows/utility/validate_data.py (2)
84-84
: Add type hint for theisImage
parameter.For consistency and better type safety, add a type hint for the new parameter.
-def validateRawGithubContent(uri: str, isImage: bool): +def validateRawGithubContent(uri: str, isImage: bool) -> None:
92-92
: Fix typo in comment.Correct the spelling of "image" in the comment.
- # check imgae size + # check image size
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/utility/validate_data.py
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages: registry-initiation-1
🔇 Additional comments (2)
.github/workflows/utility/validate_data.py (2)
45-45
: LGTM! Consistent updates to image validation calls.All image-related function calls have been correctly updated to include the new
isImage
parameter, ensuring consistent size validation for both chain and asset images.Also applies to: 47-47, 50-50, 52-52, 69-69, 71-71, 75-75, 77-77
84-98
: Verify image size limits match frontend requirements.The implemented size limits (10KB for SVG, 100KB for other images) should be verified against the limits defined in
_api/src/optimizeImages.ts
as mentioned in the PR description.✅ Verification successful
Size limits are correctly synchronized
The image size limits in
validate_data.py
perfectly match those defined in_api/src/optimizeImages.ts
:
- SVG files: 10KB (10 * 1024 bytes)
- PNG/other images: 100KB (100 * 1024 bytes)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for image size limits in the frontend code rg -i "size.*limit|maxSize" _api/src/optimizeImages.tsLength of output: 283
Deploying registry-initiation-1 with Cloudflare Pages
|
Deploying registry-testnet with Cloudflare Pages
|
Deploying registry-devnet with Cloudflare Pages
|
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: 0
♻️ Duplicate comments (1)
.github/workflows/utility/validate_data.py (1)
92-98
: 🛠️ Refactor suggestionEnhance image size validation implementation.
The current implementation needs several improvements:
- Extract magic numbers into named constants
- Add file extension validation
- Include path normalization
- Enhance error message with actual and limit sizes
Previous review suggestions for these improvements are still valid and should be implemented.
🧹 Nitpick comments (1)
.github/workflows/utility/validate_data.py (1)
84-84
: Consider making isImage parameter optional with a default value.The new
isImage
parameter could have a default value ofFalse
to maintain backward compatibility with any existing calls.-def validateRawGithubContent(uri: str, isImage: bool): +def validateRawGithubContent(uri: str, isImage: bool = False):
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/utility/validate_data.py
(2 hunks)_api/src/optimizeImages.ts
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PR Workflow
.github/workflows/utility/validate_data.py
[error] 71-71: Pipeline execution failed during chain validation
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages: registry-initiation-1
🔇 Additional comments (2)
_api/src/optimizeImages.ts (1)
10-10
: Verify SVG size limit consistency across files.The SVG size limit has been increased from 10KB to 20KB. This change must be synchronized with the validation logic in
validate_data.py
to maintain consistent size checks.Run this script to verify size limit consistency:
.github/workflows/utility/validate_data.py (1)
71-71
:⚠️ Potential issueInvestigate chain validation pipeline failure.
The pipeline failed during chain validation at this line. This could be due to:
- An oversized SVG file
- A missing file
- An invalid file path
Run this script to investigate the failure:
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] 71-71: Pipeline execution failed during chain validation
On
_api/src/optimizeImages.ts
, there is a image size limit. So add image size validationSummary by CodeRabbit