fix(storage): swap reversed sourceKey/targetKey args in OssStorageAdapter.copyObjectInSelfBucket (#6806)

The ali-oss `copy(name, sourceName)` API expects the destination as the
first argument and the source as the second. The previous implementation
passed an encoded sourceKey as the destination and targetKey as the source,
causing copy operations to attempt reading from the target path (which
does not exist yet) and writing to the source path (overwriting the original).

This bug caused custom plugin uploads to fail when using OSS storage, since
the plugin file could not be moved from the temp path to its final location.

Fixes #6787, #6648

Co-authored-by: octo-patch <octo-patch@github.com>
This commit is contained in:
Octopus
2026-04-23 16:24:35 +08:00
committed by GitHub
parent eb9df08695
commit 39d74852ca
+1 -6
View File
@@ -341,12 +341,7 @@ export class OssStorageAdapter implements IStorage {
async copyObjectInSelfBucket(params: CopyObjectParams): Promise<CopyObjectResult> {
const { sourceKey, targetKey } = params;
const encodedSourceKey = sourceKey
.split('/')
.map((segment) => encodeURIComponent(segment))
.join('/');
await this.client.copy(encodedSourceKey, targetKey);
await this.client.copy(targetKey, sourceKey);
return {
bucket: this.options.bucket,