Skip to content

lightgun-poc / lib/static / normalizeUrlPath

Function: normalizeUrlPath()

normalizeUrlPath(urlPath): string | null

Defined in: lib/static.ts:26

Turns a request target into a clean relative file path, or null if it is malformed. Query/hash are dropped, percent-escapes decoded, and backslashes folded to / so a request resolves to the same file on Windows (where `` is a path separator) as on Linux (where it is a legal filename byte).

Parameters

urlPath

string

Returns

string | null

Released under the MIT License.