Skip to content

Commit

Permalink
🐛 Fix: tencent cos upload error
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Aug 17, 2022
1 parent 879b98d commit 61df53a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"start": "node ./bin/picgo",
"lint": "eslint src/**/*.ts && npm run build",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rimraf ./dist && rollup -c rollup.config.js",
"dev": "rollup -c rollup.config.js -w",
"build": "cross-env NODE_ENV=production rimraf ./dist && rollup -c rollup.config.js",
"dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
"patch": "npm version patch && git push origin master && git push origin --tags",
"minor": "npm version minor && git push origin master && git push origin --tags",
"major": "npm version major && git push origin master && git push origin --tags",
Expand Down Expand Up @@ -74,6 +74,7 @@
"builtins": "^4.0.0",
"conventional-changelog": "^3.0.6",
"copyfiles": "^2.1.0",
"cross-env": "^7.0.3",
"cz-customizable": "^5.10.0",
"eslint": "7",
"eslint-config-standard-with-typescript": "^18.0.2",
Expand Down
9 changes: 7 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { string } from 'rollup-plugin-string'
import json from '@rollup/plugin-json'
import builtins from 'builtins'
import replace from '@rollup/plugin-replace'

const version = process.env.VERSION || pkg.version
const sourcemap = 'inline'
const banner = `/*
Expand All @@ -33,7 +32,7 @@ const commonOptions = {
}
}
}),
terser(),
// terser(),
commonjs(),
string({
// Required to be specified
Expand All @@ -52,6 +51,12 @@ const commonOptions = {
input
}

const isDev = process.env.NODE_ENV === 'development'

if (!isDev) {
commonOptions.plugins.push(terser())
}

/** @type import('rollup').RollupOptions */
const nodeCjs = {
output: [{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/uploader/tcyun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const postOptions = (options: ITcyunConfig, fileName: string, signature: ISignat
} else {
return {
method: 'PUT',
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${encodeURI(path)}${encodeURI(fileName)}`,
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${encodeURIComponent(path)}${encodeURIComponent(fileName)}`,
headers: {
Host: `${options.bucket}.cos.${options.area}.myqcloud.com`,
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}`,
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,13 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand All @@ -1723,7 +1730,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"

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

0 comments on commit 61df53a

Please sign in to comment.