parent
866fbb20b6
commit
1265305bac
1 changed files with 9 additions and 1 deletions
10
src/main.rs
10
src/main.rs
|
@ -262,7 +262,7 @@ struct PastebinConfig {
|
|||
|
||||
#[structopt(
|
||||
long = "slug-charset",
|
||||
help = "Character set to use for generating the URL slug",
|
||||
help = "Character set (expressed as rust compatible regex) to use for generating the URL slug",
|
||||
default_value = "[A-Za-z0-9_-]"
|
||||
)]
|
||||
slug_charset: String,
|
||||
|
@ -646,6 +646,14 @@ fn rocket(pastebin_config: PastebinConfig) -> rocket::Rocket {
|
|||
panic!("the TTL flag should match one of the ui-expiry-times option");
|
||||
}
|
||||
|
||||
if pastebin_config.slug_len == 0 {
|
||||
panic!("slug_len must be larger than zero");
|
||||
}
|
||||
|
||||
if alphabet.len() == 0 {
|
||||
panic!("selected slug alphabet is empty, please check if slug_charset is a valid regex");
|
||||
}
|
||||
|
||||
let uri_prefix = pastebin_config.uri_prefix.clone();
|
||||
let resources = load_static_resources!(
|
||||
"../static/index.html",
|
||||
|
|
Loading…
Reference in a new issue