Skip to main content

file

Function file 

Source
pub fn file(cx: &Cx, path: &str) -> String
Expand description

The URL to link or show a stored file at: path with a signature that expires, when it names a file under a Panel::uploads_dir of any panel on the router, and path itself otherwise.

Call it only on a page that has checked the user may see the record storing path: the URL opens the file for whoever holds it, for two hours. Each call signs under a fresh nonce, so two calls for the same path return different URLs.

let src = tablo_core::url::file(cx, "/uploads/0b9c…-cover.png");
// "/uploads/0b9c…-cover.png?expires=…&signature=…"