Skip to main content

validate_source_uri

Function validate_source_uri 

Source
pub fn validate_source_uri(s: &str) -> Result<()>
Expand description

v0.7.0 Form 4 (issue #757) — validate a URI-form source pointer.

Accepts three schemes:

  • uri:<...> — HTTP(S) URL or other absolute URI.
  • doc:<...> — substrate document id (caller-supplied opaque).
  • file:<...> — filesystem path.

In every case the payload after the scheme must be non-empty (the validator strips the scheme prefix and re-checks). Bare strings without a scheme are rejected so a caller does not accidentally stuff a role label into the URI column.

§Errors

Returns when the input is empty, exceeds [MAX_SOURCE_URI_LEN], uses an unrecognised scheme, or carries an empty payload.