Skip to content

Commit

Permalink
check for existing
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrmcdaniel committed May 27, 2024
1 parent 50ad64d commit 5abd2af
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions privaxy/src/server/web_gui/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ pub async fn add_filter(

// Clone the URL to avoid moving the original value
let filter_url = add_filter_request.url.clone();
if configuration.filters.iter().any(|filter| filter.url == add_filter_request.url) {
log::warn!("Filter with URL {} already exists", add_filter_request.url);
return Ok(Response::builder()
.status(http::StatusCode::CONFLICT)
.body("Filter already exists".to_string())
.unwrap());
}

// Add the new filter to the configuration
let mut new_filter = Filter {
Expand Down

0 comments on commit 5abd2af

Please sign in to comment.