@be-link/cos 1.12.6 → 1.12.8
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/bin/upload.js +5 -5
- package/package.json +1 -1
package/bin/upload.js
CHANGED
|
@@ -62,9 +62,7 @@ async function getTempCredentials(mode) {
|
|
|
62
62
|
|
|
63
63
|
try {
|
|
64
64
|
const response = await fetch(url, { method: 'POST' });
|
|
65
|
-
console.log('🔐 响应:', response);
|
|
66
65
|
const result = await response.json();
|
|
67
|
-
console.log('🔐 结果:', result);
|
|
68
66
|
const data = result?.data || {};
|
|
69
67
|
const credentials = data?.credentials;
|
|
70
68
|
|
|
@@ -131,8 +129,8 @@ async function initCOS() {
|
|
|
131
129
|
|
|
132
130
|
console.log('✅ 使用环境变量中的密钥');
|
|
133
131
|
cos = new COS({
|
|
134
|
-
SecretId:
|
|
135
|
-
SecretKey:
|
|
132
|
+
SecretId: secretId,
|
|
133
|
+
SecretKey: secretKey,
|
|
136
134
|
});
|
|
137
135
|
|
|
138
136
|
return cos;
|
|
@@ -148,7 +146,7 @@ function upload(url, filename, retryCount = 0, maxRetries = 3) {
|
|
|
148
146
|
reject(new Error('上传参数错误:url 和 filename 不能为空'));
|
|
149
147
|
return;
|
|
150
148
|
}
|
|
151
|
-
|
|
149
|
+
console.log('🔐 上传参数:', { url, filename, bucketConfig, region, projectRemoteUrl });
|
|
152
150
|
cos.putObject(
|
|
153
151
|
{
|
|
154
152
|
Bucket: bucketConfig.name,
|
|
@@ -163,6 +161,8 @@ function upload(url, filename, retryCount = 0, maxRetries = 3) {
|
|
|
163
161
|
// },
|
|
164
162
|
},
|
|
165
163
|
function (err, data) {
|
|
164
|
+
console.log(`🔐 上传结果: ${JSON.stringify(data)}`);
|
|
165
|
+
console.log(`❕ 上传失败: ${JSON.stringify(err)}`);
|
|
166
166
|
if (err) {
|
|
167
167
|
// 重试逻辑
|
|
168
168
|
if (retryCount < maxRetries) {
|