mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user