fix: upload more than 100 files in directory (#317)
This commit is contained in:
parent
8590f3e841
commit
cd84dff87f
1 changed files with 21 additions and 13 deletions
|
@ -126,9 +126,9 @@ function ready() {
|
||||||
|
|
||||||
class Uploader {
|
class Uploader {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {File} file
|
* @param {File} file
|
||||||
* @param {string[]} dirs
|
* @param {string[]} dirs
|
||||||
*/
|
*/
|
||||||
constructor(file, dirs) {
|
constructor(file, dirs) {
|
||||||
/**
|
/**
|
||||||
|
@ -240,7 +240,7 @@ Uploader.runQueue = async () => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add breadcrumb
|
* Add breadcrumb
|
||||||
* @param {string} href
|
* @param {string} href
|
||||||
* @param {string} uri_prefix
|
* @param {string} uri_prefix
|
||||||
*/
|
*/
|
||||||
function addBreadcrumb(href, uri_prefix) {
|
function addBreadcrumb(href, uri_prefix) {
|
||||||
|
@ -365,8 +365,8 @@ function renderPathsTableBody() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add pathitem
|
* Add pathitem
|
||||||
* @param {PathItem} file
|
* @param {PathItem} file
|
||||||
* @param {number} index
|
* @param {number} index
|
||||||
*/
|
*/
|
||||||
function addPath(file, index) {
|
function addPath(file, index) {
|
||||||
const encodedName = encodedStr(file.name);
|
const encodedName = encodedStr(file.name);
|
||||||
|
@ -583,8 +583,8 @@ async function setupEditorPage() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete path
|
* Delete path
|
||||||
* @param {number} index
|
* @param {number} index
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function deletePath(index) {
|
async function deletePath(index) {
|
||||||
const file = DATA.paths[index];
|
const file = DATA.paths[index];
|
||||||
|
@ -616,8 +616,8 @@ async function doDeletePath(name, url, cb) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move path
|
* Move path
|
||||||
* @param {number} index
|
* @param {number} index
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function movePath(index) {
|
async function movePath(index) {
|
||||||
const file = DATA.paths[index];
|
const file = DATA.paths[index];
|
||||||
|
@ -694,7 +694,7 @@ async function checkAuth() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a folder
|
* Create a folder
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
async function createFolder(name) {
|
async function createFolder(name) {
|
||||||
const url = newUrl(name);
|
const url = newUrl(name);
|
||||||
|
@ -732,8 +732,16 @@ async function addFileEntries(entries, dirs) {
|
||||||
new Uploader(file, dirs).upload();
|
new Uploader(file, dirs).upload();
|
||||||
});
|
});
|
||||||
} else if (entry.isDirectory) {
|
} else if (entry.isDirectory) {
|
||||||
const dirReader = entry.createReader()
|
const dirReader = entry.createReader();
|
||||||
dirReader.readEntries(entries => addFileEntries(entries, [...dirs, entry.name]));
|
|
||||||
|
const successCallback = entries => {
|
||||||
|
if (entries.length > 0) {
|
||||||
|
addFileEntries(entries, [...dirs, entry.name]);
|
||||||
|
dirReader.readEntries(successCallback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
dirReader.readEntries(successCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue