only try to use uris starting with http{,s}
This commit is contained in:
parent
004887799e
commit
a309d19e61
10
src/main.rs
10
src/main.rs
@ -26,9 +26,6 @@ struct Video {
|
||||
link: Link,
|
||||
}
|
||||
|
||||
// Always use a limit to prevent DoS attacks.
|
||||
const LIMIT: u64 = 1024;
|
||||
|
||||
impl fmt::Display for Link {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.uri)
|
||||
@ -53,7 +50,11 @@ impl<'v> FromFormValue<'v> for Link {
|
||||
Ok(abs_uri) => Some(abs_uri),
|
||||
Err(_) => continue,
|
||||
};
|
||||
break;
|
||||
if abs_uri.as_ref().unwrap().scheme() == "http"
|
||||
|| abs_uri.as_ref().unwrap().scheme() == "https"
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for success
|
||||
@ -71,6 +72,7 @@ impl<'v> FromFormValue<'v> for Link {
|
||||
|
||||
#[post("/new", data = "<video>")]
|
||||
fn new(video: Form<Video>) -> Redirect {
|
||||
dbg!(&video.link);
|
||||
Command::new("/bin/env")
|
||||
.args(&[
|
||||
"DISPLAY=:0",
|
||||
|
Loading…
Reference in New Issue
Block a user