mirror of
https://github.com/immich-app/immich.git
synced 2026-02-23 19:50:15 -05:00
fix: prevent server crash when extraction of metadata fails if the assets are corrupted (#26042)
* Fix-25968 Extraction of metadata fails if the assets are corrupted * chore: clean up --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
parent
c4c7f94317
commit
2e59dbdc12
@ -38,6 +38,9 @@ import { isFaceImportEnabled } from 'src/utils/misc';
|
||||
import { upsertTags } from 'src/utils/tag';
|
||||
import { Tasks } from 'src/utils/tasks';
|
||||
|
||||
const POSTGRES_INT_MAX = 2_147_483_647;
|
||||
const POSTGRES_INT_MIN = -2_147_483_648;
|
||||
|
||||
/** look for a date from these tags (in order) */
|
||||
const EXIF_DATE_TAGS: Array<keyof ImmichTags> = [
|
||||
'SubSecDateTimeOriginal',
|
||||
@ -90,7 +93,10 @@ const validate = <T>(value: T): NonNullable<T> | null => {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof value === 'number' && (Number.isNaN(value) || !Number.isFinite(value))) {
|
||||
if (
|
||||
typeof value === 'number' &&
|
||||
(Number.isNaN(value) || !Number.isFinite(value) || value < POSTGRES_INT_MIN || value > POSTGRES_INT_MAX)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user