22 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
5- import type { AxiosError , AxiosResponse } from 'axios'
6- import type { WebDAVClient } from 'webdav'
7- import type { IDirectory } from './utils/fileTree'
8-
9- import { getCurrentUser } from '@nextcloud/auth'
10- import { FileType , Folder , Permission , davGetClient , davRemoteURL , davRootPath } from '@nextcloud/files'
11- import { encodePath } from '@nextcloud/paths'
12- import { normalize } from 'path'
13-
14- import axios , { isCancel } from '@nextcloud/axios'
5+ import type { AxiosError , AxiosResponse } from 'axios'
6+ import type { WebDAVClient } from 'webdav'
7+ import type { IDirectory } from './utils/fileTree'
8+
9+ import { getCurrentUser } from '@nextcloud/auth'
10+ import {
11+ davGetClient ,
12+ davRemoteURL ,
13+ davRootPath ,
14+ FileType ,
15+ Folder ,
16+ Permission
17+ } from '@nextcloud/files'
18+ import { encodePath } from '@nextcloud/paths'
19+ import { normalize } from 'path'
20+
21+ import axios , { isCancel } from '@nextcloud/axios'
1522import PCancelable from 'p-cancelable'
1623import PQueue from 'p-queue'
1724
18- import { getChunk , initChunkWorkspace , uploadData } from './utils/upload.js'
19- import { getMaxChunksSize } from './utils/config.js'
20- import { Status as UploadStatus , Upload } from './upload.js'
21- import { isFileSystemFileEntry } from './utils/filesystem.js'
22- import { Directory } from './utils/fileTree.js'
23- import { t } from './utils/l10n.js'
25+ import { getChunk , initChunkWorkspace , uploadData } from './utils/upload.js'
26+ import { getMaxChunksSize } from './utils/config.js'
27+ import { Status as UploadStatus , Upload } from './upload.js'
28+ import { isFileSystemFileEntry } from './utils/filesystem.js'
29+ import { Directory } from './utils/fileTree.js'
30+ import { t } from './utils/l10n.js'
2431import logger from './utils/logger.js'
25- import { getCapabilities } from '@nextcloud/capabilities'
32+ import { getCapabilities } from '@nextcloud/capabilities'
2633
2734export enum Status {
2835 IDLE = 0 ,
@@ -508,6 +515,11 @@ export class Uploader {
508515 await Promise . all ( chunksQueue )
509516 this . updateStats ( )
510517
518+ // re-add upload because it was reset
519+ this . _uploadQueue . push ( upload )
520+ upload . status = UploadStatus . ASSEMBLING
521+ this . updateStats ( )
522+
511523 upload . response = await axios . request ( {
512524 method : 'MOVE' ,
513525 url : `${ tempUrl } /.file` ,
@@ -519,8 +531,9 @@ export class Uploader {
519531 } ,
520532 } )
521533
522- this . updateStats ( )
534+ this . _uploadQueue . push ( upload )
523535 upload . status = UploadStatus . FINISHED
536+ this . updateStats ( )
524537 logger . debug ( `Successfully uploaded ${ file . name } ` , { file, upload } )
525538 resolve ( upload )
526539 } catch ( error ) {
0 commit comments