Photos won't show up in Photos app (through browser) when image doesn't have a specific metadata #1833
Labels
0. Needs triage
Pending approval or rejection. This issue is pending approval.
bug
Something isn't working
**Describe the bug**
After uploading some image files the Photo app stops showing the images (thumbnails don't load).
===> Issue identified (check below)
===> Fix suggested (check below)
To Reproduce
Expected behavior
Thumbnails show up in Photo app
Screenshots
Desktop (please complete the following information):
Issue identified
The problem happens only in the browser in the front-end of the Photos app. When generating the thumbnails. the object
file
has a propertyfileMetadataSize
which is a string representing the width and height of the image. The program will parse it to extract the width and height as properties offileMetadataSizeParsed
. The problem happens when the propertyfileMetadataSize
is an empty string, this throws an error becauseJSON.parse()
can't parse empty strings and the Nullish coalescing operator (??
) won't assign'{}'
because.replace()
won't returnnull
and the Optional chaining (?.
) won't break the chain since an empty string is not null.Note line 54 in the snippet below (in
photos/src/store/files.js
):Line 54 causes the following error:
This happens because
""
does not parse.My proposed solution is to make a check before that and assign
"{}"
if thefile.fileMetadataSize
is""
. I will be making a pull request for that.Below is the proposed solution in conext.
Sample image causing error
IMG_2471.HEIC.zip
The text was updated successfully, but these errors were encountered: