提交 466aa0da authored 作者: 吴强's avatar 吴强
...@@ -115,7 +115,7 @@ export async function queryResourceByUsageAndAnyTags(usage, tags, pst = -1, psz ...@@ -115,7 +115,7 @@ export async function queryResourceByUsageAndAnyTags(usage, tags, pst = -1, psz
/** /**
* 上传文件,支持后台上传 * 上传文件,支持后台上传
* @param path 文件绝对路径,类似file:///xxx格式 * @param path 文件绝对路径
* @param {UploadErrorCallback} [error] 错误回调,上传失败会调用此回调,并传入错误异常 * @param {UploadErrorCallback} [error] 错误回调,上传失败会调用此回调,并传入错误异常
* @param {UploadCompleteCallback} [complete] 成功回调,上传成功会调用此回调,并传入服务端资源内部uri * @param {UploadCompleteCallback} [complete] 成功回调,上传成功会调用此回调,并传入服务端资源内部uri
* @param {UploadProgressCallback} [progress] 上传进度回调,可以获得进度 * @param {UploadProgressCallback} [progress] 上传进度回调,可以获得进度
...@@ -123,7 +123,11 @@ export async function queryResourceByUsageAndAnyTags(usage, tags, pst = -1, psz ...@@ -123,7 +123,11 @@ export async function queryResourceByUsageAndAnyTags(usage, tags, pst = -1, psz
* @return {Promise<string>} uploadId 上传id,用于引用上传任务 * @return {Promise<string>} uploadId 上传id,用于引用上传任务
*/ */
export async function uploadResource(path, error = () => {}, complete = () => {}, progress = () => {}, uri) { export async function uploadResource(path, error = () => {}, complete = () => {}, progress = () => {}, uri) {
const { exists, mimeType } = await Upload.getFileInfo(path.substring(7)); if (path.startsWith('file:///')) {
// eslint-disable-next-line no-param-reassign
path = path.substring(7);
}
const { exists, mimeType } = await Upload.getFileInfo(path);
if (exists) { if (exists) {
const token = await getToken(); const token = await getToken();
let url; let url;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论