Repository navigation
Conversation
…prefix when filename is unique per prefix
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Resolve prefix and check filename collisions packages/plugin-cloud-storage/src/utilities/resolveSignedURLKey.ts, packages/plugin-cloud-storage/src/utilities/resolveSignedURLKey.spec.ts |
resolveSignedURLKey resolves the sanitized document prefix before checking filename collisions. It passes the prefix to getSafeFileName when filenameCompoundIndex includes prefix. Tests cover prefixed and unscoped checks and use a shared request object in existing cases. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: nathanlentz, jessrynkar
Merge Risk: 
Minimal · up to b460c
-
The client upload lookup follows the configured filename uniqueness mode, with no merge-blocking risk identified.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the affected plugin and the core change: client upload filename deduplication is scoped to the prefix when the compound index includes prefix. It matches the raw summary and objectives. The title is long (110 characters) but still specific and accurate.
Full details: Description check
-
Explanation
The description states the change, the cause, the approach, and the test coverage. It links the issue (
#19246) and a backport. It directly describes the changed behavior in resolveSignedURLKey, so it is on topic.
Full details: Linked Issues check
-
Explanation
Issue
#19246requires prefix-scoped collision checks for client-upload signing whenfilenameCompoundIndexincludesprefix.resolveSignedURLKeynow resolvessanitizedDocPrefixbefore the collision check and passes it togetSafeFileNamein that case. It passesundefinedotherwise, which preserves global filename checks. The unit specs cover both configurations.
Full details: Out of Scope Changes check
-
Explanation
The changes are limited to the linked issue. The implementation updates prefix selection for filename collision checks. The tests verify prefix-scoped and global lookup behavior. No unrelated product behavior is present in the reviewed diff.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- 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.
What?
With
upload.filenameCompoundIndexcontainingprefix, the client upload signing step now checks for a duplicate filename only inside the signed prefix.Why?
resolveSignedURLKeycalledgetSafeFileNamewithout a prefix, so the lookup ran across the whole collection. Uploadinglogo.pnginto prefix B was renamed tologo-1.pngbecause prefix A already had alogo.png, even though the compound index allows the same name in different prefixes. Server uploads already pass the prefix ingenerateFileData.How?
The prefix is resolved before the duplicate check and passed to
getSafeFileNamewhen the collection's filename is unique per prefix. Without the compound index the unique index onfilenamestays global, so the lookup stays global too. Added a unit spec.Fixes #19246
3.x backport: #19248