fix: update key handling in StorageR2Adapter to conditionally prepend keyPrefix

- Modified getKey method to prepend keyPrefix only if it is not empty, ensuring correct key formatting.
This commit is contained in:
dswbx
2025-10-26 21:04:37 +01:00
parent 0dbf71e6b5
commit 574b37abcd

View File

@@ -177,8 +177,11 @@ export class StorageR2Adapter extends StorageAdapter {
} }
protected getKey(key: string) { protected getKey(key: string) {
if (this.keyPrefix.length > 0) {
return `${this.keyPrefix}/${key}`.replace(/^\/\//, "/"); return `${this.keyPrefix}/${key}`.replace(/^\/\//, "/");
} }
return key;
}
toJSON(secrets?: boolean) { toJSON(secrets?: boolean) {
return { return {