majc: fix redirects

This commit is contained in:
Cadey Ratio 2020-08-08 16:05:13 -04:00
parent 1429602370
commit 6b9070e200
1 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,7 @@ use cursive::{
use maj::{self, Response};
use rustls::ClientConfig;
use std::str;
use url::Url;
/// The state of the browser.
#[derive(Clone)]
@ -153,13 +154,17 @@ pub fn show(siv: &mut Cursive, url: &str, resp: Response) {
TemporaryRedirect => {
let st = siv.user_data::<State>().unwrap();
st.history.pop();
open(siv, resp.meta.as_str());
let u = Url::parse(url).unwrap();
let u = u.join(resp.meta.as_str()).unwrap();
open(siv, u.as_str());
}
PermanentRedirect => {
let st = siv.user_data::<State>().unwrap();
st.history.pop();
open(siv, resp.meta.as_str());
let u = Url::parse(url).unwrap();
let u = u.join(resp.meta.as_str()).unwrap();
open(siv, u.as_str());
}
Input => {