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

Photoview page "crashes" when trying to display sidebar for media with invalid gps data #850

Open
lesensei opened this issue May 30, 2023 · 3 comments · May be fixed by #951
Open

Photoview page "crashes" when trying to display sidebar for media with invalid gps data #850

lesensei opened this issue May 30, 2023 · 3 comments · May be fixed by #951
Assignees
Labels
bug Something isn't working good first issue Good for newcomers scanner Related to the scanner component
Projects

Comments

@lesensei
Copy link

Describe the bug
One of our family camera seems to use a default "max" value for latitude and longitude data when the GPS can't fix a position. This translates to the following:

# exiftool -location:all photo.JPG
Location                        :
Country                         :
State                           :
City                            :
Landmark                        :
City 2                          :
GPS Version ID                  : 2.3.0.0
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Altitude Ref                : Above Sea Level
GPS Status                      : Measurement Void
GPS Measure Mode                : 2-Dimensional Measurement
GPS Dilution Of Precision       : 0
GPS Img Direction Ref           : Magnetic North
GPS Img Direction               : 202.5
GPS Map Datum                   : WGS-84
GPS Processing Method           : GPS
GPS Area Information            :
GPS Altitude                    : 0 m Above Sea Level
GPS Latitude                    : 17056881 deg 51' 12.15" N
GPS Longitude                   : 17056881 deg 51' 12.15" E
GPS Position                    : 17056881 deg 51' 12.15" N, 17056881 deg 51' 12.15" E

The scanner doesn't choke on this and integrates the values in the database (with maker/model for ref):

MariaDB [photoview]> select camera,maker,gps_latitude,gps_longitude from media_exif where id = 1;
+----------+-----------+-----------------+-----------------+
| camera   | maker     | gps_latitude    | gps_longitude   |
+----------+-----------+-----------------+-----------------+
| DMC-TZ40 | Panasonic | 17056881.853375 | 17056881.853375 |
+----------+-----------+-----------------+-----------------+

However, the problem arises when trying to display the info sidebar for one of the affected pictures (from the dev console):

Error: Invalid LngLat latitude value: must be between -90 and 90
    bt https://[fqdn]/assets/mapbox-gl.9b1e4062.js:8
    convert https://[fqdn]/assets/mapbox-gl.9b1e4062.js:8
    jumpTo https://[fqdn]/assets/mapbox-gl.9b1e4062.js:1081
    Map https://[fqdn]/assets/mapbox-gl.9b1e4062.js:1085
    D https://[fqdn]/assets/MapboxMap.284406f0.js:86
    Zs https://[fqdn]/assets/index.5073f743.js:32
    [...]

This actually results in an empty webpage (empty div#root), and I need to reload the whole page (ctrl-r or F5) to resume navigating my photos.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a photo with invalid gps data
  2. Click on the icon to open the media sidebar
  3. The gallery crashes and the dev console shows the mapbox error

Expected behavior
Either sanitize gps values before calling mapbox widget or when scanning media before saving exif data to db.

Your environment:
Feel free to remove and add what you think might be useful.

  • Are you using Docker? yes
  • Database : mariadb 10.11.3
  • Browser : checked with Firefox and Edge
  • Version : 2.3.13 (446ef9a4)

Thanks for this software !

@lesensei lesensei added the bug Something isn't working label May 30, 2023
@kkovaletp
Copy link
Contributor

@lesensei, please share an example image with such incorrect GPS data, so that we can try to reproduce the issue on our side. You can use some file sharing service and post here a link to the file, but please put it into an archive without password to make sure that no intermediate service parser is modifying it

@kkovaletp kkovaletp added scanner Related to the scanner component needs information Needs more information in order to fix pending response A issue or PR which is waiting for clarifications from OP labels Apr 30, 2024
@lesensei
Copy link
Author

P1020746.zip
Hope this works, as I've never uploaded files to github before.
Here's one of the photos I have with the reported problem.

@kkovaletp
Copy link
Contributor

Thanks @lesensei , with this image I've reproduced the issue.

  • Scanner job completed with successful parse of the provided image and no errors reported against it
  • Here is what has been added to the Photoview DB:
title gps_latitude gps_longitude
IncorrectGPS.jpg 17056881.6666667 17056881.6666667
  • when I try to open the Info sidebar, the page loads the data about the picture and crashes on GPS data with the next JS errors:
17:53:32.859 Error: Invalid LngLat latitude value: must be between -90 and 90
    bt http://localhost:8000/assets/mapbox-gl.fe42628b.js:8
    convert http://localhost:8000/assets/mapbox-gl.fe42628b.js:8
    jumpTo http://localhost:8000/assets/mapbox-gl.fe42628b.js:1081
    Map http://localhost:8000/assets/mapbox-gl.fe42628b.js:1085
    Ee http://localhost:8000/assets/MapboxMap.02a5fa61.js:86
    eu http://localhost:8000/assets/index.9b57b0a0.js:32
    ni http://localhost:8000/assets/index.9b57b0a0.js:32
    zb http://localhost:8000/assets/index.9b57b0a0.js:32
    S http://localhost:8000/assets/index.9b57b0a0.js:17
    J http://localhost:8000/assets/index.9b57b0a0.js:17
    EventHandlerNonNull* http://localhost:8000/assets/index.9b57b0a0.js:17
    <anonymous> http://localhost:8000/assets/index.9b57b0a0.js:17
index.9b57b0a0.js:32:175
    gc http://localhost:8000/assets/index.9b57b0a0.js:32
    callback http://localhost:8000/assets/index.9b57b0a0.js:32
    Ud http://localhost:8000/assets/index.9b57b0a0.js:30
    oh http://localhost:8000/assets/index.9b57b0a0.js:32
    ly http://localhost:8000/assets/index.9b57b0a0.js:32
    Db http://localhost:8000/assets/index.9b57b0a0.js:32
    zb http://localhost:8000/assets/index.9b57b0a0.js:32
    sn http://localhost:8000/assets/index.9b57b0a0.js:32
    uh http://localhost:8000/assets/index.9b57b0a0.js:32
    nn http://localhost:8000/assets/index.9b57b0a0.js:30
    ni http://localhost:8000/assets/index.9b57b0a0.js:32
    zb http://localhost:8000/assets/index.9b57b0a0.js:32
    S http://localhost:8000/assets/index.9b57b0a0.js:17
    J http://localhost:8000/assets/index.9b57b0a0.js:17
    (Async: EventHandlerNonNull)
    <anonymous> http://localhost:8000/assets/index.9b57b0a0.js:17
    <anonymous> http://localhost:8000/assets/index.9b57b0a0.js:17
17:53:32.861 Uncaught Error: Invalid LngLat latitude value: must be between -90 and 90
    bt http://localhost:8000/assets/mapbox-gl.fe42628b.js:8
    convert http://localhost:8000/assets/mapbox-gl.fe42628b.js:8
    jumpTo http://localhost:8000/assets/mapbox-gl.fe42628b.js:1081
    Map http://localhost:8000/assets/mapbox-gl.fe42628b.js:1085
    Ee http://localhost:8000/assets/MapboxMap.02a5fa61.js:86
    eu http://localhost:8000/assets/index.9b57b0a0.js:32
    ni http://localhost:8000/assets/index.9b57b0a0.js:32
    zb http://localhost:8000/assets/index.9b57b0a0.js:32
    S http://localhost:8000/assets/index.9b57b0a0.js:17
    J http://localhost:8000/assets/index.9b57b0a0.js:17
    EventHandlerNonNull* http://localhost:8000/assets/index.9b57b0a0.js:17
    <anonymous> http://localhost:8000/assets/index.9b57b0a0.js:17
mapbox-gl.fe42628b.js:8:66553
    bt http://localhost:8000/assets/mapbox-gl.fe42628b.js:8
    convert http://localhost:8000/assets/mapbox-gl.fe42628b.js:8
    jumpTo http://localhost:8000/assets/mapbox-gl.fe42628b.js:1081
    Map http://localhost:8000/assets/mapbox-gl.fe42628b.js:1085
    Ee http://localhost:8000/assets/MapboxMap.02a5fa61.js:86
    eu http://localhost:8000/assets/index.9b57b0a0.js:32
    ni http://localhost:8000/assets/index.9b57b0a0.js:32
    zb http://localhost:8000/assets/index.9b57b0a0.js:32
    S http://localhost:8000/assets/index.9b57b0a0.js:17
    J http://localhost:8000/assets/index.9b57b0a0.js:17
    (Async: EventHandlerNonNull)
    <anonymous> http://localhost:8000/assets/index.9b57b0a0.js:17
    <anonymous> http://localhost:8000/assets/index.9b57b0a0.js:17

I thinks that the best way to fix this issue is to add the GPS data validation after it is extracted from the file by the scanner job and before it is stored in the DB:
If an incorrect data received:

  • An error should be generated and shown in the STDERR, as well as in the pop-up in the user interface if there is an active session. It should contain the file path and the received GPS data, as well as the expectations for GPS data to be considered correct.
  • The incorrect values should be dropped and Null values should be processed down the pipeline instead

@kkovaletp kkovaletp added help wanted Extra attention is needed and removed needs information Needs more information in order to fix pending response A issue or PR which is waiting for clarifications from OP labels May 21, 2024
@kkovaletp kkovaletp added this to To do in Roadmap via automation May 21, 2024
@kkovaletp kkovaletp linked a pull request May 21, 2024 that will close this issue
@kkovaletp kkovaletp added the good first issue Good for newcomers label May 21, 2024
@kkovaletp kkovaletp linked a pull request May 22, 2024 that will close this issue
@kkovaletp kkovaletp removed the help wanted Extra attention is needed label Jun 8, 2024
@kkovaletp kkovaletp moved this from To do to In progress in Roadmap Jun 8, 2024
@kkovaletp kkovaletp self-assigned this Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers scanner Related to the scanner component
Projects
Roadmap
In progress
Development

Successfully merging a pull request may close this issue.

2 participants