|
@@ -88,10 +88,15 @@ export default class BlobTool {
|
|
|
* @param {any} path 文件夹路径 只需要文件夹名称 前后都不需要加‘/’
|
|
|
* @param {any} option 官方可配置项
|
|
|
* @param {any} checkSize 上传时是否检查容器空间 默认需要检查大小
|
|
|
+ * @param {any} root path验证的根目录 默认为'/'
|
|
|
* @returns {object} {url, name,size,createTime,extension,type}
|
|
|
*/
|
|
|
- upload(file, path, option = {}, checkSize = true) {
|
|
|
- if (!blobPath.includes(path.split('/')[0])) {
|
|
|
+ upload(file, path, option = {}, checkSize = true,root = '/') {
|
|
|
+ console.log(arguments)
|
|
|
+ let checkPath = root === '/' ? path : path.replace(root,'')
|
|
|
+ console.log(root);
|
|
|
+ console.log(checkPath);
|
|
|
+ if (!blobPath.includes(checkPath.split('/')[0])) {
|
|
|
throw new Error('上传路径不合法,请检查上传路径:' + path)
|
|
|
}
|
|
|
return new Promise(async (r, j) => {
|