Skip to content

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

pub struct RelPath(String);

A validated UTF-8 path below a Home.

Implements: Clone, Debug, Eq, Hash, PartialEq

pub fn new(path: impl AsRef<str>) -> Result<Self, PathError>

Validate a path with the same limits used by the server filesystem.

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.

pub fn join(&self, child: &str) -> Result<Self, PathError>

Append one validated relative path below this path.

pub fn join_internal_temp_cleanup(&self, child: &str) -> Result<Self, PathError>

Append a reserved temporary path for cleanup after a server delete.

pub fn user_home(id: &str) -> Result<Self, PathError>

Resolve an immutable user ID as one component below users.

pub fn as_str(&self) -> &str

No doc comment.

Source: crates/calternal-path/src/lib.rs:15

pub enum AppleDoubleResource

The 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 ._name attribute file attached to a visible file or folder.
  • Directory(Option<RelPath>): A .DS_Store view file attached to its folder, including the Home root.

Implements: Clone, Debug, Eq, PartialEq

Source: crates/calternal-path/src/lib.rs:68

pub enum PathError

A path is too long or contains an invalid or reserved component.

Variants

  • InvalidPath
  • NameTooLong

Implements: Clone, Copy, Debug, Eq, PartialEq

Source: crates/calternal-path/src/lib.rs:8

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

pub fn is_hidden_name(name: &str) -> bool

Whether 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

pub fn is_hidden_path(path: &str) -> bool

Whether any /-separated component of a relative path is hidden.

Source: crates/calternal-path/src/lib.rs:132

pub fn is_internal_path(path: &str) -> bool

Whether 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

pub fn is_internal_temp(path: &str) -> bool

Whether 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

pub fn is_not_user_activity(path: &str) -> bool

Whether 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

pub fn is_reserved(path: &str) -> bool

Whether a validated path enters a storage-owned namespace. Finder metadata uses a reserved Home child so public parent listings stay unchanged (#648).

Source: crates/calternal-path/src/lib.rs:172