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