mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-24 09:40:16 +08:00
Fixed: #60
This commit is contained in:
@@ -8,7 +8,7 @@ const postOptions = (fileName, options, data) => {
|
||||
const {token, repo} = options
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `https://api.github.com/repos/${repo}/contents/${path}${encodeURI(fileName)}`,
|
||||
url: `https://api.github.com/repos/${repo}/contents/${encodeURI(path)}${encodeURI(fileName)}`,
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
'User-Agent': 'PicGo'
|
||||
|
||||
@@ -49,7 +49,7 @@ const postOptions = (fileName, signature, imgBase64) => {
|
||||
if (!options.version || options.version === 'v4') {
|
||||
return {
|
||||
method: 'POST',
|
||||
url: `http://${area}.file.myqcloud.com/files/v2/${signature.appId}/${signature.bucket}/${path}${fileName}`,
|
||||
url: `http://${area}.file.myqcloud.com/files/v2/${signature.appId}/${signature.bucket}/${encodeURI(path)}${fileName}`,
|
||||
headers: {
|
||||
Host: `${area}.file.myqcloud.com`,
|
||||
Authorization: signature.signature,
|
||||
@@ -63,7 +63,7 @@ const postOptions = (fileName, signature, imgBase64) => {
|
||||
} else {
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${path}${encodeURI(fileName)}`,
|
||||
url: `http://${options.bucket}.cos.${options.area}.myqcloud.com/${encodeURI(path)}${encodeURI(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}`,
|
||||
|
||||
@@ -13,7 +13,7 @@ const generateSignature = (fileName) => {
|
||||
const password = options.password
|
||||
const md5Password = MD5(password)
|
||||
const date = new Date().toGMTString()
|
||||
const uri = `/${options.bucket}/${path}${encodeURI(fileName)}`
|
||||
const uri = `/${options.bucket}/${encodeURI(path)}${encodeURI(fileName)}`
|
||||
const value = `PUT&${uri}&${date}`
|
||||
const sign = crypto.createHmac('sha1', md5Password).update(value).digest('base64')
|
||||
return `UPYUN ${operator}:${sign}`
|
||||
@@ -25,7 +25,7 @@ const postOptions = (fileName, signature, imgBase64) => {
|
||||
const path = options.path || ''
|
||||
return {
|
||||
method: 'PUT',
|
||||
url: `https://v0.api.upyun.com/${bucket}/${path}${encodeURI(fileName)}`,
|
||||
url: `https://v0.api.upyun.com/${bucket}/${encodeURI(path)}${encodeURI(fileName)}`,
|
||||
headers: {
|
||||
Authorization: signature,
|
||||
Date: new Date().toGMTString()
|
||||
|
||||
Reference in New Issue
Block a user