Skip to content

Commit

Permalink
Improve URI validation
Browse files Browse the repository at this point in the history
  • Loading branch information
glyn committed Jun 28, 2024
1 parent 1a41bb7 commit 64fbba2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ async fn handler(State(state): State<ServerState>, Query(params): Query<Params>)
.unwrap()
} else {
let uri = uri.get(0).unwrap();
let parsed_uri = Uri::parse(uri);
if parsed_uri.is_err() || parsed_uri.unwrap().scheme().is_none() {
let uri_reference = Uri::parse(uri);
if uri_reference.is_err() || uri_reference.unwrap().is_relative() {
// Malformed "resource" parameter
Response::builder()
.status(StatusCode::BAD_REQUEST)
Expand Down

0 comments on commit 64fbba2

Please sign in to comment.