diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts index a060e1a7f8..2b95f3f8ca 100644 --- a/web/src/lib/utils/asset-utils.ts +++ b/web/src/lib/utils/asset-utils.ts @@ -11,6 +11,7 @@ import { } from '@api'; import { handleError } from './handle-error'; import { DateTime } from 'luxon'; +import type { AxiosProgressEvent } from 'axios'; export const addAssetsToAlbum = async (albumId: string, assetIds: Array): Promise => api.albumApi @@ -125,8 +126,8 @@ export const downloadFile = async (asset: AssetResponseDto) => { { id, key: api.getKey() }, { responseType: 'blob', - onDownloadProgress: (event: ProgressEvent) => { - if (event.lengthComputable) { + onDownloadProgress: (event: AxiosProgressEvent) => { + if (event.total !== undefined) { downloadManager.update(downloadKey, event.loaded, event.total); } }, diff --git a/web/src/lib/utils/file-uploader.ts b/web/src/lib/utils/file-uploader.ts index 3c19c052a8..e915d7991f 100644 --- a/web/src/lib/utils/file-uploader.ts +++ b/web/src/lib/utils/file-uploader.ts @@ -84,7 +84,9 @@ async function fileUploader(asset: File, albumId: string | undefined = undefined }, { onUploadProgress: ({ loaded, total }) => { - uploadAssetsStore.updateProgress(deviceAssetId, loaded, total); + if (total) { + uploadAssetsStore.updateProgress(deviceAssetId, loaded, total); + } }, }, ),