From 26aba525c0c55cb0ec77cf3a788cb59de2683cee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Sep 2026 07:18:52 -0400 Subject: uid and paths separator "~" in place of ":" need a character to split filenames on in certain circumstances. there problems with use of a colon in filenames, which is legal on posix but not on Windows."~" fits the bill better being legal on every filesystem of interest and is unreserved in rfc 3986, needing no escaping in a url. The reference abstraction is renamed, its content unchanged. Over the sample collection two filenames move and nothing else does: the abstraction and database digests are identical, the archive's members and their sizes are unchanged, and only the member order shifts, "~" collating after letters where ":" sorted before them. The document's epub dc:identifier is a v5 uuid derived from the uid, so it changes for those filenames. Every document's uid changes in the search database (spine.search.db). (assisted by Claude-Code) --- org/in_markup_source_files.org | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'org/in_markup_source_files.org') diff --git a/org/in_markup_source_files.org b/org/in_markup_source_files.org index 68de6fb..f4ab434 100644 --- a/org/in_markup_source_files.org +++ b/org/in_markup_source_files.org @@ -925,9 +925,14 @@ template spineCarriedNames() { enum size_t MAX_CARRIED_NAME_LENGTH = 255; /+ one path component +/ enum size_t MAX_CARRIED_PATH_LENGTH = 1024; /+ the whole path +/ enum size_t MAX_CARRIED_PATH_DEPTH = 10; /+ as read_zip_pod.d +/ - /+ ↓ allowed characters: a filename has no separator, a path has "/" +/ - static auto rgx_safe_carried_name = ctRegex!(`^[a-zA-Z0-9._ -]+$`); - static auto rgx_safe_carried_path = ctRegex!(`^[a-zA-Z0-9._/ -]+$`); + /+ ↓ allowed characters: a filename has no separator, a path has "/". + "~" is here because it is spine's own uid separator (InlineMarkup.uid_sep), + which joins a pod name to a document name where the two differ, as in + sisu-manual~sisu_markup.en.ssp. It cannot occur in either half, every + filesystem of interest takes it, and it is unreserved in rfc 3986. + +/ + static auto rgx_safe_carried_name = ctRegex!(`^[a-zA-Z0-9._ ~-]+$`); + static auto rgx_safe_carried_path = ctRegex!(`^[a-zA-Z0-9._/ ~-]+$`); /+ ↓ the checks both rules share, "" when the name is acceptable +/ private string _carriedNameCommon(string _name) { if (_name.length == 0) { -- cgit v1.2.3