Skip to content

fix: use correct rule ID format and deployment values for chunked site deployments#12265

Open
DEADSERPENT wants to merge 2 commits into
appwrite:1.9.xfrom
DEADSERPENT:fix/site-deployment-chunked-upload-rule-id
Open

fix: use correct rule ID format and deployment values for chunked site deployments#12265
DEADSERPENT wants to merge 2 commits into
appwrite:1.9.xfrom
DEADSERPENT:fix/site-deployment-chunked-upload-rule-id

Conversation

@DEADSERPENT
Copy link
Copy Markdown

What does this PR do?

Fixes inconsistencies in the chunked site deployment upload flow in:

  • src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php

Fix 1 — Correct rule ID format handling

The single-chunk upload flow already respects _APP_RULES_FORMAT by conditionally using either:

  • md5($domain) (legacy format)
  • ID::unique() (current format)

However, the chunked upload path was hardcoded to always use md5($domain), causing large/chunked site deployments to incorrectly generate legacy-format rule IDs regardless of environment configuration.

This PR updates the chunked upload flow to use the same $isMd5 logic as the single-chunk implementation.

Fix 2 — Consistent deployment value usage

The chunked upload flow updated site attributes using:

  • $site->getAttribute(...)

immediately after setting those attributes from the deployment object.

The equivalent single-chunk flow directly used deployment values instead.

This PR aligns the chunked upload flow with the existing single-chunk implementation by using deployment values directly for consistency and clarity.

Test Plan

  • Verified chunked deployments now respect the configured _APP_RULES_FORMAT
  • Confirmed large/chunked uploads correctly generate rule IDs using the same logic as single-chunk uploads
  • Verified deployment attributes update correctly after deployment completion
  • Compared behavior against the existing single-chunk upload flow to ensure consistency

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?

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 10, 2026

Greptile Summary

This PR fixes two bugs in the chunked site deployment upload path in Sites/Http/Deployments/Create.php, aligning it with the already-correct single-chunk path. It also adds descriptive error messages to the unsupported file type exception in both the Sites and Functions deployment handlers.

  • Rule ID format fix: The chunked upload path was hardcoded to md5($domain) for rule IDs, ignoring _APP_RULES_FORMAT. It now uses the same $isMd5 guard as the single-chunk path, so large/chunked uploads generate the correct ID format based on environment configuration.
  • Deployment value consistency: The updateDocument call for the sites collection in the chunked path previously read values back via $site->getAttribute() immediately after setting them; it now reads directly from $deployment, matching the single-chunk flow.

Confidence Score: 5/5

Safe to merge — both fixes are narrow, well-targeted corrections that bring the chunked upload path into parity with the already-correct single-chunk path.

The two fixes are straightforward: one corrects a hardcoded md5($domain) that ignored the environment-configured format, and the other removes an unnecessary indirection through $site->getAttribute(). Both changes are directly validated against the existing single-chunk code path in the same file, and the Functions change is limited to an error message string. No logic regressions were identified.

No files require special attention.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php Two bug fixes: rule ID generation in the chunked path now respects _APP_RULES_FORMAT, and updateDocument uses deployment values directly instead of indirecting through $site->getAttribute(). Also adds a descriptive error message for unsupported file types. All changes are correct and consistent with the existing single-chunk code path.
src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php Only change is adding a human-readable message to the STORAGE_FILE_TYPE_UNSUPPORTED exception throw — no logic changes.

Reviews (1): Last reviewed commit: "fix: use correct rule ID format and depl..." | Re-trigger Greptile

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