High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(web): mismatched deviceAssetId when uploading images (#15130)
Jin Xuanabf5b0afe109
diff --git a/web/src/lib/utils/file-uploader.ts b/web/src/lib/utils/file-uploader.tsindex 2e31605e91..407501e622 100644--- a/web/src/lib/utils/file-uploader.ts+++ b/web/src/lib/utils/file-uploader.ts@@ -83,14 +83,19 @@ export const openFileUploadDialog = async (options: FileUploadParam = {}) => {});};-export const fileUploadHandler = async (files: File[], albumId?: string, assetId?: string): Promise<string[]> => {+export const fileUploadHandler = async (+ files: File[],+ albumId?: string,+ replaceAssetId?: string,+): Promise<string[]> => {const extensions = await getExtensions();const promises = [];for (const file of files) {const name = file.name.toLowerCase();if (extensions.some((extension) => name.endsWith(extension))) {- uploadAssetsStore.addItem({ id: getDeviceAssetId(file), file, albumId });- promises.push(uploadExecutionQueue.addTask(() => fileUploader(file, albumId, assetId)));+ const deviceAssetId = getDeviceAssetId(file);+ uploadAssetsStore.addItem({ id: deviceAssetId, file, albumId });+ promises.push(uploadExecutionQueue.addTask(() => fileUploader(file, deviceAssetId, albumId, replaceAssetId)));}}@@ -103,9 +108,13 @@ function getDeviceAssetId(asset: File) {}// TODO: should probably use the @api SDK-async function fileUploader(assetFile: File, albumId?: string, replaceAssetId?: string): Promise<string | undefined> {+async function fileUploader(+ assetFile: File,+ deviceAssetId: string,+ albumId?: string,+ replaceAssetId?: string,+): Promise<string | undefined> {const fileCreatedAt = new Date(assetFile.lastModified).toISOString();- const deviceAssetId = getDeviceAssetId(assetFile);const $t = get(t);uploadAssetsStore.markStarted(deviceAssetId);@@ -148,6 +157,7 @@ async function fileUploader(assetFile: File, albumId?: string, replaceAssetId?:}} catch (error) {console.error(`Error calculating sha1 file=${assetFile.name})`, error);+ throw error;}}