Skip to content

fix: update search attribute on storage bucket and file name changes#11871

Open
yogeshwaran-c wants to merge 1 commit intoappwrite:1.9.xfrom
yogeshwaran-c:fix/storage-search-attribute-update
Open

fix: update search attribute on storage bucket and file name changes#11871
yogeshwaran-c wants to merge 1 commit intoappwrite:1.9.xfrom
yogeshwaran-c:fix/storage-search-attribute-update

Conversation

@yogeshwaran-c
Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When a bucket name is updated via PUT /v1/storage/buckets/:bucketId or a file name is updated via PUT /v1/storage/buckets/:bucketId/files/:fileId, the search attribute is not updated. This means the fulltext search index retains the old name, making renamed buckets and files unfindable by their new names.

Every other module in the codebase correctly updates the search attribute when names change:

  • Databases/Http/Databases/Update.php->setAttribute('search', implode(' ', [$databaseId, $searchName]))
  • Functions/Http/Functions/Update.php'search' => implode(' ', [$functionId, $name, $runtime])
  • Sites/Http/Sites/Update.php'search' => implode(' ', [$siteId, $name, $framework])
  • Teams/Http/Teams/Name/Update.php->setAttribute('search', implode(' ', [$teamId, $name]))
  • Projects/Http/Projects/Update.php->setAttribute('search', implode(' ', [$projectId, $name]))

The Storage module is the only one missing this update.

What is the new behavior?

  • Bucket Update: The search attribute is now updated to implode(' ', [$bucketId, $name]) when the bucket is updated, matching the format used during bucket creation.
  • File Update: The search attribute is now updated to implode(' ', [$fileId, $name]) when the file name is changed, matching the format used during file creation. This only happens when a new name is actually provided (the name parameter is optional).

Test plan

  • Update a bucket name and verify the bucket appears in search results using the new name
  • Update a file name and verify the file appears in search results using the new name
  • Verify that updating a file without providing a name does not change the search attribute
  • Run existing storage E2E tests to confirm no regressions: docker compose exec appwrite test tests/e2e/Services/Storage

The search attribute was not being updated when bucket or file names
were changed via the update endpoints, causing stale search index data
and making renamed buckets and files unfindable by their new names.

All other modules (Databases, Functions, Sites, Teams, Projects)
already update the search attribute on name changes - this aligns the
Storage module with that established pattern.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 12, 2026

Greptile Summary

This PR fixes a bug where renaming a storage bucket or file did not update the search attribute, causing those resources to be unfindable by their new names. The fix correctly mirrors the implode(' ', [$id, $name]) format used at creation time for both buckets and files, and is consistent with how every other module (Databases, Functions, Sites, Teams, Projects) handles name changes.

Confidence Score: 5/5

Safe to merge — the changes are minimal, correct, and consistent with the rest of the codebase.

Both additions exactly replicate the search format used at document creation. The file-update path correctly gates the search write behind the existing !is_null($name) check. No regressions are expected and no P0/P1 issues were found.

No files require special attention.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Modules/Storage/Http/Buckets/Update.php Adds search attribute update (implode(' ', [$bucketId, $name])) to the bucket update chain, matching the format used in bucket creation and other modules.
src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Update.php Adds search attribute update inside the existing !is_null($name) guard, correctly keeping it conditional on a name being provided and matching the creation format.

Reviews (1): Last reviewed commit: "fix: update search attribute on storage ..." | 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