Skip to main content

Module filename

Module filename 

Source
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§

CopyNameTemplate
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_len UTF-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_len bytes without splitting a UTF-8 code point.
validate_name
Validates a file or folder name after Unicode normalization.