calternal-path
Validated relative paths shared by the server and sync client.
This crate checks path syntax only. It never opens a file or resolves a path against the host filesystem.
Source: crates/calternal-path/src/lib.rs
Structs
Section titled “Structs”RelPath
Section titled “RelPath”pub struct RelPath(String);A validated UTF-8 path below a Home.
Implements: Clone, Debug, Eq, Hash, PartialEq
RelPath::new
Section titled “RelPath::new”pub fn new(path: impl AsRef<str>) -> Result<Self, PathError>Validate a path with the same limits used by the server filesystem.
RelPath::internal_temp_cleanup
Section titled “RelPath::internal_temp_cleanup”pub fn internal_temp_cleanup(path: impl AsRef<str>) -> Result<Self, PathError>Validate an internal temporary path only for a feed-driven cleanup. Ordinary path construction continues to reject this reserved namespace.
RelPath::join
Section titled “RelPath::join”pub fn join(&self, child: &str) -> Result<Self, PathError>Append one validated relative path below this path.
RelPath::join_internal_temp_cleanup
Section titled “RelPath::join_internal_temp_cleanup”pub fn join_internal_temp_cleanup(&self, child: &str) -> Result<Self, PathError>Append a reserved temporary path for cleanup after a server delete.
RelPath::user_home
Section titled “RelPath::user_home”pub fn user_home(id: &str) -> Result<Self, PathError>Resolve an immutable user ID as one component below users.
RelPath::as_str
Section titled “RelPath::as_str”pub fn as_str(&self) -> &strNo doc comment.
Source: crates/calternal-path/src/lib.rs:15
AppleDoubleResource
Section titled “AppleDoubleResource”pub enum AppleDoubleResourceThe visible Home item that owns one AppleDouble metadata resource.
The WebDAV adapter uses this result to keep a companion inside the same
Home scope as its attached item. A ._name companion holds attributes for
a file or folder; a .DS_Store resource belongs to its parent folder.
The provider checks the attached type; None means the Home root (#648).
Variants
File(RelPath): A._nameattribute file attached to a visible file or folder.Directory(Option<RelPath>): A.DS_Storeview file attached to its folder, including the Home root.
Implements: Clone, Debug, Eq, PartialEq
Source: crates/calternal-path/src/lib.rs:68
PathError
Section titled “PathError”pub enum PathErrorA path is too long or contains an invalid or reserved component.
Variants
InvalidPathNameTooLong
Implements: Clone, Copy, Debug, Eq, PartialEq
Source: crates/calternal-path/src/lib.rs:8
Functions
Section titled “Functions”appledouble_resource
Section titled “appledouble_resource”pub fn appledouble_resource(path: &str) -> Option<AppleDoubleResource>Parse one supported AppleDouble path without accepting hidden parents.
Only a final ._name or .DS_Store component has AppleDouble meaning.
This check does not identify the client; the DAV route still requires the
macOS WebDAV User-Agent before it accepts such a path (#648).
Source: crates/calternal-path/src/lib.rs:80
is_hidden_name
Section titled “is_hidden_name”pub fn is_hidden_name(name: &str) -> boolWhether a file or folder name is hidden: it starts with an ASCII dot
(.env, .git, .calternal, .calternal.json).
This is the one rule for “hidden”. The web Files view uses the same rule
(isHiddenName in apps/web/src/lib/files/model.ts) and hides these
names unless “Show hidden files” is on. Shares never show them: a public
link or a member recipient sees only what the owner saw (DESIGN §22).
Only U+002E counts. A look-alike dot (U+2024 ONE DOT LEADER, U+FF0E
FULLWIDTH FULL STOP) names a different file that the owner sees, and
NFC, which new names get, never turns it into .. Case does not matter
because a dot has no case. . and .. are hidden too, so a path that
passes this check has no dot segments.
Source: crates/calternal-path/src/lib.rs:127
is_hidden_path
Section titled “is_hidden_path”pub fn is_hidden_path(path: &str) -> boolWhether any /-separated component of a relative path is hidden.
Source: crates/calternal-path/src/lib.rs:132
is_internal_path
Section titled “is_internal_path”pub fn is_internal_path(path: &str) -> boolWhether a path belongs to a calternal-owned namespace.
This accepts both data-directory paths (users/<id>/.calternal/settings.json)
and paths relative to one Home (.calternal/settings.json). Unlike
is_not_user_activity, a hidden user file such as .env is not internal.
Files can use this distinction to show hidden user files while keeping
calternal’s settings, collection files, Trash and write temporaries private.
Source: crates/calternal-path/src/lib.rs:153
is_internal_temp
Section titled “is_internal_temp”pub fn is_internal_temp(path: &str) -> boolWhether any path component is a server-owned atomic-write temporary name.
These names are linked into the destination directory while a write is in progress. They must stay out of every scan and client inventory, even when a scan overlaps that short publication window.
Source: crates/calternal-path/src/lib.rs:141
is_not_user_activity
Section titled “is_not_user_activity”pub fn is_not_user_activity(path: &str) -> boolWhether a path must be excluded from user-facing activity and indexing.
Dot-prefixed names are hidden from activity even when a User chooses to show hidden files in Files. Calternal-owned paths are always excluded.
Source: crates/calternal-path/src/lib.rs:166
is_reserved
Section titled “is_reserved”pub fn is_reserved(path: &str) -> boolWhether a validated path enters a storage-owned namespace. Finder metadata uses a reserved Home child so public parent listings stay unchanged (#648).