Better error message for missing metadata

This commit is contained in:
Edward Shen 2022-01-11 23:52:20 -08:00
parent 4c7ae4feb2
commit c2bdd089e9
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -90,10 +90,16 @@ fn main() {
let (key, needs_pw) = {
let fragment = if let Some(fragment) = url.split_once('#').map(|(_, fragment)| fragment) {
fragment
if fragment.is_empty() {
error!("Key is missing in url; bailing.");
render_message("Invalid paste link: Missing metadata.".into());
return;
} else {
fragment
}
} else {
error!("Key is missing in url; bailing.");
render_message("Invalid paste link: Missing decryption key.".into());
render_message("Invalid paste link: Missing metadata.".into());
return;
};