Move helper function
This commit is contained in:
@@ -68,3 +68,12 @@ export function canDownload (share: SharedLink) {
|
|||||||
return !!share.allowDownload
|
return !!share.allowDownload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function escapeHtml (str: string): string {
|
||||||
|
return str
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''')
|
||||||
|
}
|
||||||
|
|||||||
+1
-10
@@ -1,20 +1,11 @@
|
|||||||
import immich from './immich'
|
import immich from './immich'
|
||||||
import { Response } from 'express-serve-static-core'
|
import { Response } from 'express-serve-static-core'
|
||||||
import { Asset, AssetType, ImageSize, IncomingShareRequest, SharedLink } from './types'
|
import { Asset, AssetType, ImageSize, IncomingShareRequest, SharedLink } from './types'
|
||||||
import { canDownload, getConfigOption } from './functions'
|
import { canDownload, escapeHtml, getConfigOption } from './functions'
|
||||||
import archiver from 'archiver'
|
import archiver from 'archiver'
|
||||||
import { respondToInvalidRequest } from './invalidRequestHandler'
|
import { respondToInvalidRequest } from './invalidRequestHandler'
|
||||||
import { sanitize } from './includes/sanitize'
|
import { sanitize } from './includes/sanitize'
|
||||||
|
|
||||||
function escapeHtml (str: string): string {
|
|
||||||
return str
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>')
|
|
||||||
.replace(/"/g, '"')
|
|
||||||
.replace(/'/g, ''')
|
|
||||||
}
|
|
||||||
|
|
||||||
class Render {
|
class Render {
|
||||||
lgConfig
|
lgConfig
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user