Skip to content

Commit 61df53a

Browse files
committed
🐛 Fix: tencent cos upload error
1 parent 879b98d commit 61df53a

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"start": "node ./bin/picgo",
1616
"lint": "eslint src/**/*.ts && npm run build",
1717
"test": "echo \"Error: no test specified\" && exit 1",
18-
"build": "rimraf ./dist && rollup -c rollup.config.js",
19-
"dev": "rollup -c rollup.config.js -w",
18+
"build": "cross-env NODE_ENV=production rimraf ./dist && rollup -c rollup.config.js",
19+
"dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
2020
"patch": "npm version patch && git push origin master && git push origin --tags",
2121
"minor": "npm version minor && git push origin master && git push origin --tags",
2222
"major": "npm version major && git push origin master && git push origin --tags",
@@ -74,6 +74,7 @@
7474
"builtins": "^4.0.0",
7575
"conventional-changelog": "^3.0.6",
7676
"copyfiles": "^2.1.0",
77+
"cross-env": "^7.0.3",
7778
"cz-customizable": "^5.10.0",
7879
"eslint": "7",
7980
"eslint-config-standard-with-typescript": "^18.0.2",

rollup.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { string } from 'rollup-plugin-string'
66
import json from '@rollup/plugin-json'
77
import builtins from 'builtins'
88
import replace from '@rollup/plugin-replace'
9-
109
const version = process.env.VERSION || pkg.version
1110
const sourcemap = 'inline'
1211
const banner = `/*
@@ -33,7 +32,7 @@ const commonOptions = {
3332
}
3433
}
3534
}),
36-
terser(),
35+
// terser(),
3736
commonjs(),
3837
string({
3938
// Required to be specified
@@ -52,6 +51,12 @@ const commonOptions = {
5251
input
5352
}
5453

54+
const isDev = process.env.NODE_ENV === 'development'
55+
56+
if (!isDev) {
57+
commonOptions.plugins.push(terser())
58+
}
59+
5560
/** @type import('rollup').RollupOptions */
5661
const nodeCjs = {
5762
output: [{

src/plugins/uploader/tcyun.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const postOptions = (options: ITcyunConfig, fileName: string, signature: ISignat
7171
} else {
7272
return {
7373
method: 'PUT',
74-
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${encodeURI(path)}${encodeURI(fileName)}`,
74+
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${encodeURIComponent(path)}${encodeURIComponent(fileName)}`,
7575
headers: {
7676
Host: `${options.bucket}.cos.${options.area}.myqcloud.com`,
7777
Authorization: `q-sign-algorithm=sha1&q-ak=${options.secretId}&q-sign-time=${signature.signTime}&q-key-time=${signature.signTime}&q-header-list=host&q-url-param-list=&q-signature=${signature.signature}`,

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,13 @@ create-require@^1.1.0:
17031703
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
17041704
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
17051705

1706+
cross-env@^7.0.3:
1707+
version "7.0.3"
1708+
resolved "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
1709+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
1710+
dependencies:
1711+
cross-spawn "^7.0.1"
1712+
17061713
cross-spawn@^5.0.1:
17071714
version "5.1.0"
17081715
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
@@ -1723,7 +1730,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
17231730
shebang-command "^1.2.0"
17241731
which "^1.2.9"
17251732

1726-
cross-spawn@^7.0.2, cross-spawn@^7.0.3:
1733+
cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
17271734
version "7.0.3"
17281735
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
17291736
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==

0 commit comments

Comments
 (0)