Skip to content

Commit

Permalink
fix: Add upload progress for non-chunked uploads
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Feb 4, 2024
1 parent b563ecf commit 199a3ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/upload.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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<string, string|number> = {},
): Promise<AxiosResponse> {
Expand Down

0 comments on commit 199a3ea

Please sign in to comment.