diff --git a/lib/uploader.ts b/lib/uploader.ts index 2901ac29..eab20c7f 100644 --- a/lib/uploader.ts +++ b/lib/uploader.ts @@ -295,7 +295,10 @@ export class Uploader { encodedDestinationFile, blob, upload.signal, - () => this.updateStats(), + (event) => { + upload.uploaded = upload.uploaded + event.bytes + this.updateStats() + }, undefined, { 'X-OC-Mtime': file.lastModified / 1000, diff --git a/lib/utils/upload.ts b/lib/utils/upload.ts index 85527ce3..fddfb09f 100644 --- a/lib/utils/upload.ts +++ b/lib/utils/upload.ts @@ -1,4 +1,4 @@ -import type { AxiosResponse } from 'axios' +import type { AxiosProgressEvent, AxiosResponse } from 'axios' import { generateRemoteUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' import axios from '@nextcloud/axios' @@ -22,7 +22,7 @@ export const uploadData = async function( url: string, uploadData: UploadData, signal: AbortSignal, - onUploadProgress = () => {}, + onUploadProgress:(event: AxiosProgressEvent) => void = () => {}, destinationFile: string | undefined = undefined, headers: Record = {}, ): Promise {