frohzinn's picture
download
raw
877 Bytes
import {
KEY_VALUE_PAIR_KEY_MAX_LENGTH,
KEY_VALUE_PAIR_VALUE_MAX_LENGTH,
KEY_VALUE_PAIR_UNSAFE_KEY_RE,
KEY_VALUE_PAIR_UNSAFE_VALUE_RE
} from '$lib/constants';
/**
* Strip control characters unsafe in identifier/header-name contexts and cap length.
* Removes all C0 controls (including TAB) and DEL.
*/
export function sanitizeKeyValuePairKey(raw: string): string {
return raw.replace(KEY_VALUE_PAIR_UNSAFE_KEY_RE, '').slice(0, KEY_VALUE_PAIR_KEY_MAX_LENGTH);
}
/**
* Strip control characters that enable header injection; allow TAB; cap length.
* Removes null bytes, CR/LF and other C0/DEL controls while keeping TAB (\x09),
* which is a valid header-value continuation character per RFC 7230.
*/
export function sanitizeKeyValuePairValue(raw: string): string {
return raw.replace(KEY_VALUE_PAIR_UNSAFE_VALUE_RE, '').slice(0, KEY_VALUE_PAIR_VALUE_MAX_LENGTH);
}

Xet Storage Details

Size:
877 Bytes
·
Xet hash:
8992f2f1cba7eadb648746eb0f78bf34e5ec9d5a78c71d2fa465d9062afeb8b4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.