瀏覽代碼

fix: insert data file not working

Ahmad Kholid 2 年之前
父節點
當前提交
6c0265e249
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/utils/getFile.js

+ 5 - 4
src/utils/getFile.js

@@ -55,14 +55,15 @@ function getLocalFile(path, options) {
         .then((response) => {
           if (!response.ok) throw new Error(response.statusText);
 
-          if (options.returnValue) {
-            resolve(response);
-            return Promise.resolve(null);
-          }
+          if (options.returnValue) return response.text();
 
           return response.blob();
         })
         .then((blob) => {
+          if (options.returnValue) {
+            resolve(blob);
+            return;
+          }
           if (!blob) return;
 
           if (URL.createObjectURL) {