8000 fix: update error message for site size limit by Julien-prrs · Pull Request #9905 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: update error message for site size limit #9905

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Julien-prrs
Copy link
@Julien-prrs Julien-prrs commented May 26, 2025

What does this PR do?

This PR updates the error message returned when a site deployment archive exceeds the allowed file size limit. Previously, the error incorrectly referenced the _APP_STORAGE_LIMIT environment variable. It now correctly points to _APP_COMPUTE_SIZE_LIMIT.

Test Plan

  • Attempted to deploy a site with an archive exceeding the limit via both CLI and Web UI.
  • Verified that the updated error message is returned.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Summary by CodeRabbit

  • New Features

    • Introduced a specific error message for invalid or oversized site deployment files, providing clearer feedback when file size limits are exceeded during site deployment.
  • Bug Fixes

    • Improved error handling by distinguishing between site-related and generic storage file size errors.

Copy link
coderabbitai bot commented May 26, 2025

Walkthrough

A new site-specific error code for invalid file size was introduced, including its definition in the error configuration and as a constant in the Exception class. The site deployment creation logic now throws this new error when the uploaded file size is invalid, replacing the previously used generic storage error code.

Changes

File(s) Change Summary
app/config/errors.php Added new error entry for Exception::SITE_INVALID_FILE_SIZE with name, description, and code 400.
src/Appwrite/Extend/Exception.php Introduced constant SITE_INVALID_FILE_SIZE in the Exception class.
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php Updated thrown exception from STORAGE_INVALID_FILE_SIZE to SITE_INVALID_FILE_SIZE.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SitesModule
    participant Exception

    User->>SitesModule: Upload site deployment file
    SitesModule->>SitesModule: Validate file size
    alt File size invalid
        SitesModule->>Exception: Throw SITE_INVALID_FILE_SIZE
        Exception-->>User: Return error (400, invalid file size)
    else File size valid
        SitesModule->>SitesModule: Proceed with deployment
    end
Loading

Possibly related PRs

  • Fix: unlimited deployment size #9866: Modifies file size validation logic for site deployments, allowing unlimited size if the limit is zero; both PRs adjust error handling for file size in site deployments.

Poem

A bunny hopped with files to deploy,
But oh! The size brought little joy.
Now errors speak in site’s own tongue,
No more storage songs are sung.
With clearer words, the code’s refined—
Hooray for limits, well-defined!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a68d49a and 14a4413.

📒 Files selected for processing (3)
  • app/config/errors.php (1 hunks)
  • src/Appwrite/Extend/Exception.php (1 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php (1)
src/Appwrite/Extend/Exception.php (1)
  • Exception (7-407)
app/config/errors.php (1)
src/Appwrite/Extend/Exception.php (1)
  • Exception (7-407)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: scan
🔇 Additional comments (3)
src/Appwrite/Extend/Exception.php (1)

160-160: LGTM! New site-specific error constant is properly added.

The new SITE_INVALID_FILE_SIZE constant is correctly placed in the Sites section and follows the established naming convention. This will provide better error categorization for site deployment file size issues.

app/config/errors.php (1)

583-587: Excellent! Error message now correctly references the right environment variable.

This change directly addresses the PR objective by updating the error description to reference _APP_COMPUTE_SIZE_LIMIT instead of the incorrect _APP_STORAGE_LIMIT. The error configuration is properly structured with an appropriate 400 status code for client-side validation errors.

src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php (1)

187-187:

✅ Verification successful

Good change to use site-specific error code.

This correctly updates the exception to use the new site-specific error code instead of the generic storage error, which will provide users with the corrected error message referencing _APP_COMPUTE_SIZE_LIMIT.

Let me verify that all site deployment file size validations use the new error code:


🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining usage of STORAGE_INVALID_FILE_SIZE in site-related code
# Expected: Only non-site related usage should remain

echo "=== Searching for STORAGE_INVALID_FILE_SIZE usage ==="
rg -A 3 -B 3 "STORAGE_INVALID_FILE_SIZE"

echo -e "\n=== Searching for site deployment related file size checks ==="
rg -A 5 -B 5 "siteSizeLimit|site.*size.*limit" --type php

Length of output: 6184


All site deployment file size validations now use SITE_INVALID_FILE_SIZE and no residual STORAGE_INVALID_FILE_SIZE remains in the Sites module. Approving this change.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.42-r0 CVE-2025-0840 HIGH
libexpat 2.6.4-r0 CVE-2024-8176 HIGH
libxml2 2.12.7-r0 CVE-2024-56171 HIGH
libxml2 2.12.7-r0 CVE-2025-24928 HIGH
libxml2 2.12.7-r0 CVE-2025-27113 HIGH
libxml2 2.12.7-r0 CVE-2025-32414 HIGH
libxml2 2.12.7-r0 CVE-2025-32415 HIGH
sqlite-libs 3.45.3-r1 CVE-2025-29087 HIGH
xz 5.6.2-r0 CVE-2025-31115 HIGH
xz-libs 5.6.2-r0 CVE-2025-31115 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0