Compare commits
2 commits
939ae84a10
...
d5dd28b4e5
Author | SHA1 | Date | |
---|---|---|---|
ItsDrike | d5dd28b4e5 | ||
ItsDrike | 9ec4d31813 |
|
@ -89,7 +89,7 @@ fn main() {
|
|||
while let Some(edit_code) = edit_codes.next() {
|
||||
match edit_paste(&client, &csrf_data, &edit_code, PASTE_NAME) {
|
||||
Ok(_) => {
|
||||
println!("Paste deleted successfully with edit code: {edit_code}");
|
||||
println!("Success, found edit code: {edit_code}");
|
||||
return;
|
||||
}
|
||||
Err(e) => match e {
|
||||
|
|
|
@ -85,11 +85,6 @@ impl From<Response> for EditError {
|
|||
|
||||
if status.is_redirection() {
|
||||
let location = headers.get("Location").unwrap().to_str().unwrap();
|
||||
if location == "/" {
|
||||
// This is supposed to be handled from delete_paste function,
|
||||
// This is an error enum, we can't represent success
|
||||
panic!("response is successfult");
|
||||
}
|
||||
return Self::UnexpectedRedirect(location.to_string());
|
||||
}
|
||||
|
||||
|
@ -150,7 +145,7 @@ pub fn edit_paste(
|
|||
|
||||
if res.status().is_redirection() {
|
||||
let location = res.headers().get("Location").unwrap().to_str().unwrap();
|
||||
if location == "/" {
|
||||
if location == "/".to_owned() + paste_name {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue