Merge pull request #243 from Freika/fix/immich-import-validity-bug

Fix/immich import validity bug
This commit is contained in:
Evgenii Burmakin 2024-09-13 20:20:09 +03:00 committed by GitHub
commit cf9699a932
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 13 deletions

View file

@ -1 +1 @@
0.13.5
0.13.6

View file

@ -7,7 +7,7 @@ orbs:
jobs:
test:
docker:
- image: cimg/ruby:3.3
- image: cimg/ruby:3.3.4
environment:
RAILS_ENV: test
- image: cimg/postgres:13.3

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.13.6] — 2024-09-13
### Fixed
- Flatten geodata retrieved from Immich before processing it to prevent errors
## [0.13.5] — 2024-09-08
### Added

View file

@ -465,4 +465,4 @@ RUBY VERSION
ruby 3.3.4p94
BUNDLED WITH
2.5.9
2.5.18

View file

@ -44,15 +44,8 @@ class Immich::ImportGeodata
end
end
def valid?(asset)
asset.dig('exifInfo', 'latitude') &&
asset.dig('exifInfo', 'longitude') &&
asset.dig('exifInfo', 'dateTimeOriginal')
end
def parse_immich_data(immich_data)
geodata = immich_data.map do |asset|
log_no_data and next if asset_invalid?(asset)
geodata = immich_data.flatten.map do |asset|
next unless valid?(asset)
extract_geodata(asset)
@ -61,8 +54,10 @@ class Immich::ImportGeodata
geodata.compact.sort_by { |data| data[:timestamp] }
end
def asset_invalid?(bucket)
bucket.is_a?(Hash) && bucket['statusCode'] == 404
def valid?(asset)
asset.dig('exifInfo', 'latitude') &&
asset.dig('exifInfo', 'longitude') &&
asset.dig('exifInfo', 'dateTimeOriginal')
end
def extract_geodata(asset)