Better error handling, and handling of numeric config options

This commit is contained in:
Alan Grainger
2026-07-24 22:15:17 +12:00
parent a1e440c146
commit aa6183a95d
13 changed files with 345 additions and 51 deletions
+2 -3
View File
@@ -5,7 +5,7 @@ import {
} from '../immich'
import { Response } from 'express-serve-static-core'
import { AssetType, ImageSize, SharedLink } from '../types'
import { getConfigOption } from '../config/access'
import { getConfigOption, getNumericConfigOption } from '../config/access'
import { canDownload, expiryDate, title } from '../share'
import { toString } from '../utils/text'
import { h } from 'preact'
@@ -164,8 +164,7 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
}
// HTML gallery page cache time
const configured = Number(getConfigOption('ipp.gallery.cacheTime', 300))
const cacheTime = Number.isFinite(configured) ? Math.max(0, configured) : 300
const cacheTime = Math.max(0, getNumericConfigOption('ipp.gallery.cacheTime', 300))
res.header('Cache-Control', 'public, max-age=' + cacheTime)
res.send(renderPage(h(Gallery, props)))
}