MishkaCmsCore. Runtime. Resources. Validations. PathFormat
(Mishka CMS Core v0.0.5-alpha.13)
Copy Markdown
View Source
Validates a resource path as a safe, canonical URL route path — used by the
Page, Layout, and ErrorPage resources and their drafts.
A valid path:
- starts with
/ - contains no
..(directory traversal) and no//(empty segment) - uses only letters, marks and digits of any script, and
- _ / . : *(covering nested paths, route params like:id, and wildcards like*rest):/fa/وردپرسis a path, and so is the zero-width non-joiner a Persian word is written with. No space and no other punctuation. - is at most 255 characters
It is checked as MishkaCmsCore.Runtime.States.WebRunTimeMetaDataState.canonical_path/1 reads
it, so a path pasted with its %XX escapes is checked as the letters they stand for, which is
what MishkaCmsCore.Runtime.Resources.Changes.PagePath stores.
This runs at the action boundary in every environment, so no page can be created
or edited with a path that is traversal-prone, ambiguous (//), or unroutable. It
reports the specific rule that failed, which the JSON:API surfaces to the caller —
strict enough for production, clear enough for development.
Mirrors MishkaCmsCore.Runtime.Resources.Validations.DomainValidator.