mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2025-01-08 12:35:27 +00:00
normalize URLs before setting them
This commit is contained in:
parent
e6747de998
commit
b09b51c74b
1 changed files with 4 additions and 2 deletions
|
@ -50,7 +50,7 @@ use plume_models::{
|
||||||
search::{Searcher as UnmanagedSearcher, SearcherError},
|
search::{Searcher as UnmanagedSearcher, SearcherError},
|
||||||
Connection, Error, CONFIG,
|
Connection, Error, CONFIG,
|
||||||
};
|
};
|
||||||
use rocket::{fairing::AdHoc, http::uri::Origin};
|
use rocket::{fairing::AdHoc, http::ext::IntoOwned, http::uri::Origin};
|
||||||
use rocket_csrf::CsrfFairingBuilder;
|
use rocket_csrf::CsrfFairingBuilder;
|
||||||
use scheduled_thread_pool::ScheduledThreadPool;
|
use scheduled_thread_pool::ScheduledThreadPool;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
@ -183,7 +183,9 @@ Then try to restart Plume
|
||||||
let host = req.guard::<Host>();
|
let host = req.guard::<Host>();
|
||||||
if host.is_success() {
|
if host.is_success() {
|
||||||
let rewrite_uri = format!("/custom_domains/{}/{}", host.unwrap(), req.uri());
|
let rewrite_uri = format!("/custom_domains/{}/{}", host.unwrap(), req.uri());
|
||||||
req.set_uri(Origin::parse_owned(rewrite_uri).unwrap())
|
let uri = Origin::parse_owned(rewrite_uri).unwrap();
|
||||||
|
let uri = uri.to_normalized().into_owned();
|
||||||
|
req.set_uri(uri);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue