Skip to content

fix(storage): normalize object keys in every method and base exists() on object info - #2097

Merged
spydon merged 5 commits into
mainfrom
lukasklingsbo/sdk-2778-storage-normalize-paths-in-every
Nov 16, 2026
Merged

spydon merged 5 commits into
mainfrom
lukasklingsbo/sdk-2778-storage-normalize-paths-in-every

Conversation

@spydon

@spydon spydon commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Fixes SDK-2778

Stacked on #2095.

  • move, copy, remove and create_signed_urls now normalize their keys with the same rules as every other method.
  • exists() reads object info and returns False only for NoSuchKey. Other errors, like a missing bucket or an invalid token, now raise StorageApiError.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • File existence checks now return False for missing objects while reporting other storage errors.
    • Object keys are normalized consistently for file operations, including bulk signing, move, copy, and remove.
    • Invalid keys with empty segments or . and .. segments are rejected.
    • Unicode and leading-slash object keys are handled consistently in downloads and signed URL operations.

Object-key validation now rejects empty keys, empty interior segments, and dot segments. Bulk signing, move, copy, and remove use normalized keys. The exists method now sends a GET request to the object-info endpoint and returns False only for NoSuchKey; other errors are raised. Tests cover key paths, error responses, and sync and async client behavior.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant exists
  participant ObjectInfoEndpoint
  participant parse_api_error
  Caller->>exists: Query bucket and key
  exists->>ObjectInfoEndpoint: GET object-info
  ObjectInfoEndpoint-->>exists: Response or error
  exists->>parse_api_error: Parse error response
  parse_api_error-->>exists: Error code
  exists-->>Caller: Return false for NoSuchKey
  exists-->>Caller: Raise other errors
Loading

Change: Bug fix

Merge Risk: Minimal · up to ffe91

The change makes object key handling stricter and makes exists() raise on errors other than a missing file. No concrete merge-blocking risk was found.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f9014f4-a448-4f75-b5de-a56d06d4f24e
Commits

Reviewing files that changed from the base of the PR and between 2a49071 and ffe91dd.

Files selected for processing: 4

  • src/storage/src/storage3/file_api.py
  • src/storage/tests/_async/test_client.py
  • src/storage/tests/_sync/test_client.py
  • src/storage/tests/test_file_api.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.

@spydon
spydon force-pushed the lukasklingsbo/sdk-2778-storage-normalize-paths-in-every branch from cb92b2b to b74b3de Compare November 16, 2026 17:09
Base automatically changed from lukasklingsbo/sdk-2767-storage-double-slashes-inside-object to main November 16, 2026 17:21
@spydon
spydon merged commit 6e182b0 into main Nov 16, 2026
24 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-2778-storage-normalize-paths-in-every branch November 16, 2026 17:27
spydon added a commit that referenced this pull request Nov 16, 2026
Merging #2095 and #2097 left two copies of the empty key tests in
`test_file_api.py`, so `make ruff` fails on `main` with F811.

- Keeps the copies from #2097, which cover every method.
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