From ea4f16a43668572cfbc28a4133c8b35b2a99b2f2 Mon Sep 17 00:00:00 2001 From: Alan Grainger <16197738+alangrainger@users.noreply.github.com> Date: Mon, 9 Feb 2026 11:30:56 +1300 Subject: [PATCH] Move helper function --- app/src/functions.ts | 9 +++++++++ app/src/render.ts | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/functions.ts b/app/src/functions.ts index f47155b..6f71f86 100644 --- a/app/src/functions.ts +++ b/app/src/functions.ts @@ -68,3 +68,12 @@ export function canDownload (share: SharedLink) { return !!share.allowDownload } } + +export function escapeHtml (str: string): string { + return str + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') +} diff --git a/app/src/render.ts b/app/src/render.ts index b2d9a88..fbc93cb 100644 --- a/app/src/render.ts +++ b/app/src/render.ts @@ -1,20 +1,11 @@ import immich from './immich' import { Response } from 'express-serve-static-core' import { Asset, AssetType, ImageSize, IncomingShareRequest, SharedLink } from './types' -import { canDownload, getConfigOption } from './functions' +import { canDownload, escapeHtml, getConfigOption } from './functions' import archiver from 'archiver' import { respondToInvalidRequest } from './invalidRequestHandler' import { sanitize } from './includes/sanitize' -function escapeHtml (str: string): string { - return str - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, ''') -} - class Render { lgConfig