• Percent-encode the characters of a local file path that have a special meaning in a URL ("%", "#" and "?"), so that a file named for example "Track #3.wav" is requested as "Track %233.wav" instead of being truncated to "Track " by the browser (as "#" starts the URL fragment). Other characters (like spaces) are left untouched as browsers encode them automatically. URLs are left untouched as they are already encoded.

    Duplicated in the editor (encodeLocalFileNameForUrl in newIDE/app/src/Utils/PercentEncodedFileName.js): keep both in sync.

    Parameters

    • urlOrFilename: string

    Returns string