fix(server): use GPSLongitudeRef and GPSLatitudeRef EXIF fields (#21445)

Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
This commit is contained in:
Rui Gonçalves 2025-10-21 15:12:22 +01:00 committed by GitHub
parent 9dffbaea98
commit dbd6dcb786
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 33 additions and 27 deletions

View File

@ -34,7 +34,7 @@
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^60.0.0",
"exiftool-vendored": "^28.3.1",
"exiftool-vendored": "^31.1.0",
"globals": "^16.0.0",
"jose": "^5.6.3",
"luxon": "^3.4.4",

50
pnpm-lock.yaml generated
View File

@ -238,8 +238,8 @@ importers:
specifier: ^60.0.0
version: 60.0.0(eslint@9.37.0(jiti@2.6.1))
exiftool-vendored:
specifier: ^28.3.1
version: 28.8.0
specifier: ^31.1.0
version: 31.1.0
globals:
specifier: ^16.0.0
version: 16.4.0
@ -404,8 +404,8 @@ importers:
specifier: 4.3.3
version: 4.3.3
exiftool-vendored:
specifier: ^28.8.0
version: 28.8.0
specifier: ^31.1.0
version: 31.1.0
express:
specifier: ^5.1.0
version: 5.1.0
@ -3495,8 +3495,8 @@ packages:
peerDependencies:
'@photo-sphere-viewer/core': 5.14.0
'@photostructure/tz-lookup@11.2.0':
resolution: {integrity: sha512-DwrvodcXHNSdGdeSF7SBL5o8aBlsaeuCuG7633F04nYsL3hn5Hxe3z/5kCqxv61J1q7ggKZ27GPylR3x0cPNXQ==}
'@photostructure/tz-lookup@11.2.1':
resolution: {integrity: sha512-ugPtvpdLwGQ8IWezSGFgUCYOpO/XXetfKLNv+UN2jjTYyfIDq9dA21GydGyzXuoQ06nN3VGBd3JxmEu+ZtXScg==}
'@pkgjs/parseargs@0.11.0':
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
@ -5210,9 +5210,9 @@ packages:
resolution: {integrity: sha512-qsJ8/X+UypqxHXN75M7dF88jNK37dLBRW7LeUzCPz+TNs37G8cfWy9nWzS+LS//g600zrt2le9KuXt0rWfDz5Q==}
hasBin: true
batch-cluster@13.0.0:
resolution: {integrity: sha512-EreW0Vi8TwovhYUHBXXRA5tthuU2ynGsZFlboyMJHCCUXYa2AjgwnE3ubBOJs2xJLcuXFJbi6c/8pH5+FVj8Og==}
engines: {node: '>=14'}
batch-cluster@15.0.1:
resolution: {integrity: sha512-eUmh0ld1AUPKTEmdzwGF9QTSexXAyt9rA1F5zDfW1wUi3okA3Tal4NLdCeFI6aiKpBenQhR6NmK9bW9tBHTGPQ==}
engines: {node: '>=20'}
batch@0.6.1:
resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==}
@ -6547,16 +6547,18 @@ packages:
resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
engines: {node: '>=10'}
exiftool-vendored.exe@13.0.0:
resolution: {integrity: sha512-4zAMuFGgxZkOoyQIzZMHv1HlvgyJK3AkNqjAgm8A8V0UmOZO7yv3pH49cDV1OduzFJqgs6yQ6eG4OGydhKtxlg==}
exiftool-vendored.exe@13.38.0:
resolution: {integrity: sha512-oZx5enTAvSiIAXL+OEk7nNWrfUhEdKUpaGwDjCmz4VKwOa4HbisqyM808xPGPYj8X7XikcME/fq5hvevPeE3cw==}
os: [win32]
exiftool-vendored.pl@13.0.1:
resolution: {integrity: sha512-+BRRzjselpWudKR0ltAW5SUt9T82D+gzQN8DdOQUgnSVWWp7oLCeTGBRptbQz+436Ihn/mPzmo/xnf0cv/Qw1A==}
exiftool-vendored.pl@13.38.0:
resolution: {integrity: sha512-Q3xl1nnwswrsR5344z4NyqvI74fKwla+VJHY1N+32gcDgt8cs9KBsDUwcNzKHSOSa/MjEfniuCJVrQiqR05iag==}
os: ['!win32']
hasBin: true
exiftool-vendored@28.8.0:
resolution: {integrity: sha512-R7tirJLr9fWuH9JS/KFFLB+O7jNGKuPXGxREc6YybYangEudGb+X8ERsYXk9AifMiAWh/2agNfbgkbcQcF+MxA==}
exiftool-vendored@31.1.0:
resolution: {integrity: sha512-q8StxLawHLDvhqv/uoBYCfVbDskn49Cr5ouNCZhh4lgryGu1aymHwK9AvO6RcW2SbPm5MSnQDJOfGp2MW5Nnrw==}
engines: {node: '>=20.0.0'}
expect-type@1.2.1:
resolution: {integrity: sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==}
@ -15128,7 +15130,7 @@ snapshots:
'@photo-sphere-viewer/core': 5.14.0
three: 0.180.0
'@photostructure/tz-lookup@11.2.0': {}
'@photostructure/tz-lookup@11.2.1': {}
'@pkgjs/parseargs@0.11.0':
optional: true
@ -17069,7 +17071,7 @@ snapshots:
baseline-browser-mapping@2.8.15: {}
batch-cluster@13.0.0: {}
batch-cluster@15.0.1: {}
batch@0.6.1: {}
@ -18608,21 +18610,21 @@ snapshots:
signal-exit: 3.0.7
strip-final-newline: 2.0.0
exiftool-vendored.exe@13.0.0:
exiftool-vendored.exe@13.38.0:
optional: true
exiftool-vendored.pl@13.0.1: {}
exiftool-vendored.pl@13.38.0: {}
exiftool-vendored@28.8.0:
exiftool-vendored@31.1.0:
dependencies:
'@photostructure/tz-lookup': 11.2.0
'@photostructure/tz-lookup': 11.2.1
'@types/luxon': 3.7.1
batch-cluster: 13.0.0
exiftool-vendored.pl: 13.0.1
batch-cluster: 15.0.1
exiftool-vendored.pl: 13.38.0
he: 1.2.0
luxon: 3.7.2
optionalDependencies:
exiftool-vendored.exe: 13.0.0
exiftool-vendored.exe: 13.38.0
expect-type@1.2.1: {}

View File

@ -68,7 +68,7 @@
"cookie": "^1.0.2",
"cookie-parser": "^1.4.7",
"cron": "4.3.3",
"exiftool-vendored": "^28.8.0",
"exiftool-vendored": "^31.1.0",
"express": "^5.1.0",
"fast-glob": "^3.3.2",
"fluent-ffmpeg": "^2.1.2",

View File

@ -84,6 +84,7 @@ export class MetadataRepository {
numericTags: [...DefaultReadTaskOptions.numericTags, 'FocalLength', 'FileSize'],
/* eslint unicorn/no-array-callback-reference: off, unicorn/no-array-method-this-argument: off */
geoTz: (lat, lon) => geotz.find(lat, lon)[0],
geolocation: true,
// Enable exiftool LFS to parse metadata for files larger than 2GB.
readArgs: ['-api', 'largefilesupport=1'],
writeArgs: ['-api', 'largefilesupport=1', '-overwrite_original'],

View File

@ -447,7 +447,10 @@ export class MetadataService extends BaseService {
* For RAW images in the CR2 or RAF format, the "ImageSize" value seems to be correct,
* but ImageWidth and ImageHeight are not correct (they contain the dimensions of the preview image).
*/
let [width, height] = exifTags.ImageSize?.split('x').map((dim) => Number.parseInt(dim) || undefined) || [];
let [width, height] =
exifTags.ImageSize?.toString()
?.split('x')
?.map((dim) => Number.parseInt(dim) || undefined) ?? [];
if (!width || !height) {
[width, height] = [exifTags.ImageWidth, exifTags.ImageHeight];
}