Fix success detection
This commit is contained in:
		
							parent
							
								
									a6581455e7
								
							
						
					
					
						commit
						9ec4d31813
					
				
					 1 changed files with 1 additions and 6 deletions
				
			
		| 
						 | 
					@ -85,11 +85,6 @@ impl From<Response> for EditError {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if status.is_redirection() {
 | 
					        if status.is_redirection() {
 | 
				
			||||||
            let location = headers.get("Location").unwrap().to_str().unwrap();
 | 
					            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());
 | 
					            return Self::UnexpectedRedirect(location.to_string());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,7 +145,7 @@ pub fn edit_paste(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if res.status().is_redirection() {
 | 
					    if res.status().is_redirection() {
 | 
				
			||||||
        let location = res.headers().get("Location").unwrap().to_str().unwrap();
 | 
					        let location = res.headers().get("Location").unwrap().to_str().unwrap();
 | 
				
			||||||
        if location == "/" {
 | 
					        if location == "/".to_owned() + paste_name {
 | 
				
			||||||
            return Ok(());
 | 
					            return Ok(());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue