adp-openclaw 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/adp-upload-tool.ts +12 -3
package/package.json
CHANGED
package/src/adp-upload-tool.ts
CHANGED
|
@@ -207,6 +207,8 @@ export async function getStorageCredential(
|
|
|
207
207
|
throw new Error("获取存储凭证失败: 缺少upload_url或file_url信息");
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
console.log(`[ADP-UPLOAD] Credential file_url: ${result.file_url.substring(0, 100)}...`);
|
|
211
|
+
|
|
210
212
|
return result as DescribeRemoteBotStorageCredentialRsp;
|
|
211
213
|
}
|
|
212
214
|
|
|
@@ -227,9 +229,14 @@ export async function uploadFileToCos(
|
|
|
227
229
|
// 2. 读取文件内容
|
|
228
230
|
const fileContent = await readFile(filePath);
|
|
229
231
|
|
|
230
|
-
// 3.
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
// 3. 获取预签名的上传URL和下载URL
|
|
233
|
+
// 注意:不要用 decodeURIComponent 解码整个 URL,会破坏签名参数
|
|
234
|
+
// JSON 解析已经处理了 \u0026 -> & 的转换
|
|
235
|
+
const uploadUrl = credential.upload_url;
|
|
236
|
+
const fileUrl = credential.file_url;
|
|
237
|
+
|
|
238
|
+
console.log(`[ADP-UPLOAD] upload_url: ${uploadUrl.substring(0, 100)}...`);
|
|
239
|
+
console.log(`[ADP-UPLOAD] file_url (download): ${fileUrl.substring(0, 100)}...`);
|
|
233
240
|
|
|
234
241
|
// 4. 执行上传(直接PUT到预签名URL,不需要额外签名)
|
|
235
242
|
const response = await fetchWithTimeout(
|
|
@@ -250,6 +257,8 @@ export async function uploadFileToCos(
|
|
|
250
257
|
throw new Error(`上传文件失败: ${response.status} ${errorText}`);
|
|
251
258
|
}
|
|
252
259
|
|
|
260
|
+
console.log(`[ADP-UPLOAD] Upload success, returning file_url: ${fileUrl.substring(0, 100)}...`);
|
|
261
|
+
|
|
253
262
|
// 5. 返回下载URL
|
|
254
263
|
return fileUrl;
|
|
255
264
|
}
|