Expand description
File and folder name validation helpers. File and folder name validation helpers.
This module validates names against cross-platform filesystem constraints, normalizes Unicode to NFC, and generates collision-copy names that respect byte limits. It also includes blob-key sharding helpers used when mapping logical file identifiers to storage paths.
Structs§
- Copy
Name Template - Parsed pieces of a filename used when generating copy names.
Constants§
- MAX_
FILENAME_ LEN - Maximum filename length in UTF-8 bytes.
Functions§
- char_
count - Counts Unicode scalar values in a string.
- copy_
name_ template - Parses a name into the template used to generate copy names.
- format_
copy_ name - Formats a copy name using the default filename length limit.
- format_
copy_ name_ with_ limit - Formats a copy name while keeping the result within
max_lenUTF-8 bytes. - next_
copy_ name - Returns the next copy name for a file or folder.
- normalize_
name - Normalizes a name to Unicode NFC.
- normalize_
validate_ name - Normalizes a file or folder name and validates the normalized result.
- storage_
path_ from_ blob_ key - Builds a two-level sharded storage path from a blob key.
- truncate_
utf8_ to_ max_ bytes - Truncates a string to at most
max_lenbytes without splitting a UTF-8 code point. - validate_
name - Validates a file or folder name after Unicode normalization.