Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): mismatched deviceAssetId when uploading images #15130

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jinxuan-owyong
Copy link

This PR resolves #15111

Due to a lack of permissions by the browser (Brave) which was installed via Flatpak, attempting to upload files through drag and drop resulted in zero-byte files being referenced.

file-uploader.ts:150 Error calculating sha1 file=DSC_0705.JPG) NotFoundError: A requested file or directory could not be found at the time an operation was processed.

The error counter was not incremented since the above error was not thrown. Despite this being addressed, uploadAssetsStore.updateItem did not update the upload asset preview state successfully, which hints that a mismatched deviceAssetId was used.

assetFile.lastModified seems to evaluate to a different value when logged in succession. This resulted in a different deviceAssetId used before and during the execution of fileUploader.

    if (extensions.some((extension) => name.endsWith(extension))) {
      uploadAssetsStore.addItem({ id: getDeviceAssetId(file), file, albumId });
      promises.push(uploadExecutionQueue.addTask(() => fileUploader(file, albumId, assetId)));
    }

Addressing the above issues allowed the upload failure to be properly displayed (see first vs second upload)

Screenshot from 2025-01-07 20-08-43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

duplicate images not marked as processed
2 participants