From 0f79c4ff463c38ab635ff824866c1c4db2a6f9f4 Mon Sep 17 00:00:00 2001 From: DeclanE <160616898+declan8010@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:02:31 +0000 Subject: [PATCH] feat(server): added support for SVG files (#7960) * Added SVG Support * Removed comment * Server Test fixes * Sorted the mimetypes * Reverted mimetypes.assettype * Lint * fix test --------- Co-authored-by: Alex Tran --- server/src/domain/asset/asset.service.spec.ts | 1 + server/src/domain/domain.constant.spec.ts | 1 + server/src/domain/domain.constant.ts | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/domain/asset/asset.service.spec.ts b/server/src/domain/asset/asset.service.spec.ts index 0b8dea7173..8ba5d93ba0 100644 --- a/server/src/domain/asset/asset.service.spec.ts +++ b/server/src/domain/asset/asset.service.spec.ts @@ -113,6 +113,7 @@ const validImages = [ '.sr2', '.srf', '.srw', + '.svg', '.tiff', '.webp', '.x3f', diff --git a/server/src/domain/domain.constant.spec.ts b/server/src/domain/domain.constant.spec.ts index 154128a1c2..70944328e4 100644 --- a/server/src/domain/domain.constant.spec.ts +++ b/server/src/domain/domain.constant.spec.ts @@ -41,6 +41,7 @@ describe('mimeTypes', () => { { mimetype: 'image/sr2', extension: '.sr2' }, { mimetype: 'image/srf', extension: '.srf' }, { mimetype: 'image/srw', extension: '.srw' }, + { mimetype: 'image/svg', extension: '.svg' }, { mimetype: 'image/tiff', extension: '.tif' }, { mimetype: 'image/tiff', extension: '.tiff' }, { mimetype: 'image/webp', extension: '.webp' }, diff --git a/server/src/domain/domain.constant.ts b/server/src/domain/domain.constant.ts index b723474dd3..56b455855e 100644 --- a/server/src/domain/domain.constant.ts +++ b/server/src/domain/domain.constant.ts @@ -133,13 +133,14 @@ const image: Record = { '.sr2': ['image/sr2', 'image/x-sony-sr2'], '.srf': ['image/srf', 'image/x-sony-srf'], '.srw': ['image/srw', 'image/x-samsung-srw'], + '.svg': ['image/svg'], '.tif': ['image/tiff'], '.tiff': ['image/tiff'], '.webp': ['image/webp'], '.x3f': ['image/x3f', 'image/x-sigma-x3f'], }; -const profileExtensions = new Set(['.avif', '.dng', '.heic', '.heif', '.jpeg', '.jpg', '.png', '.webp']); +const profileExtensions = new Set(['.avif', '.dng', '.heic', '.heif', '.jpeg', '.jpg', '.png', '.webp', '.svg']); const profile: Record = Object.fromEntries( Object.entries(image).filter(([key]) => profileExtensions.has(key)), );