mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix(server): enforce strict equality (===)
- asset.repository: use === undefined (consistent with other visibility checks at lines 709/766) - bytes: magnitude === 0 for number comparison - storage-template: asset.type === AssetType.Image All three were loose == which allows coercion and is flagged by eqeqeq / type-aware lint.
This commit is contained in:
parent
35c2a90fca
commit
7a2b016bc0
3 changed files with 4 additions and 4 deletions
|
|
@ -838,7 +838,7 @@ export class AssetRepository {
|
|||
)
|
||||
.$if(!!options.withCoordinates, (qb) => qb.select(['asset_exif.latitude', 'asset_exif.longitude']))
|
||||
.where('asset.deletedAt', options.isTrashed ? 'is not' : 'is', null)
|
||||
.$if(options.visibility == undefined, withDefaultVisibility)
|
||||
.$if(options.visibility === undefined, withDefaultVisibility)
|
||||
.$if(!!options.visibility, (qb) => qb.where('asset.visibility', '=', options.visibility!))
|
||||
.$if(!!options.bbox, (qb) => {
|
||||
const bbox = options.bbox!;
|
||||
|
|
|
|||
|
|
@ -402,8 +402,8 @@ export class StorageTemplateService extends BaseService {
|
|||
const substitutions: Record<string, string> = {
|
||||
filename,
|
||||
ext: extension,
|
||||
filetype: asset.type == AssetType.Image ? 'IMG' : 'VID',
|
||||
filetypefull: asset.type == AssetType.Image ? 'IMAGE' : 'VIDEO',
|
||||
filetype: asset.type === AssetType.Image ? 'IMG' : 'VID',
|
||||
filetypefull: asset.type === AssetType.Image ? 'IMAGE' : 'VIDEO',
|
||||
assetId: asset.id,
|
||||
assetIdShort: asset.id.slice(-12),
|
||||
//just throw into the root if it doesn't belong to an album
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export function asHumanReadable(bytes: number, precision = 1): string {
|
|||
}
|
||||
}
|
||||
|
||||
return `${remainder.toFixed(magnitude == 0 ? 0 : precision)} ${units[magnitude]}`;
|
||||
return `${remainder.toFixed(magnitude === 0 ? 0 : precision)} ${units[magnitude]}`;
|
||||
}
|
||||
|
||||
// if an asset is jsonified in the DB before being returned, its buffer fields will be hex-encoded strings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue