normalize_public_asset_url

Function normalize_public_asset_url 

Source
pub fn normalize_public_asset_url(
    field_name: &str,
    value: &str,
    max_len: usize,
) -> Result<String>
Expand description

Normalizes a public frontend asset URL.

Empty values are allowed for optional branding assets. Non-empty values are trimmed, byte-length limited, rejected when they contain whitespace, and accepted when they are either a leading-slash path or an absolute http(s) URL. The predicate intentionally mirrors the historical Aster branding behavior so existing product configuration keeps the same storage semantics.

ยงErrors

Returns an error when the trimmed value exceeds max_len bytes, contains whitespace, or is neither a root-relative path nor an absolute HTTP(S) URL.