Added: qiniu upload custom path

This commit is contained in:
Molunerfinn
2018-03-09 23:24:48 +08:00
parent e1c151e310
commit 4e8dfef6cb
3 changed files with 13 additions and 2 deletions

View File

@@ -6,7 +6,8 @@ import { Notification } from 'electron'
function postOptions (fileName, token, imgBase64) {
const area = selectArea(db.read().get('picBed.qiniu.area').value() || 'z0')
const base64FileName = Buffer.from(fileName, 'utf-8').toString('base64').replace(/\+/g, '-').replace(/\//g, '_')
const path = db.read().get('picBed.qiniu.path') || ''
const base64FileName = Buffer.from(path + fileName, 'utf-8').toString('base64').replace(/\+/g, '-').replace(/\//g, '_')
return {
method: 'POST',
url: `http://upload${area}.qiniu.com/putb64/-1/key/${base64FileName}`,