diff --git a/src/domain/settings.rs b/src/domain/settings.rs
index 3112b11..18156ae 100644
--- a/src/domain/settings.rs
+++ b/src/domain/settings.rs
@@ -14,7 +14,6 @@ pub struct Settings {
#[serde(flatten)]
pub origin_descr: origin::Descr,
- pub remove_path_prefix: Option,
pub add_path_prefix: Option,
}
@@ -25,31 +24,6 @@ impl Settings {
Ok(h.finalize().encode_hex::())
}
- fn remove_path_prefix<'path, 'prefix>(
- path: borrow::Cow<'path, str>,
- prefix: &'prefix str,
- ) -> borrow::Cow<'path, str> {
- if prefix.len() == 0 {
- return path;
- }
-
- let mut prefix = prefix.trim_end_matches('/');
- prefix = prefix.trim_start_matches('/');
-
- let mut stripped_path = path.trim_start_matches('/');
-
- if !stripped_path.starts_with(prefix) {
- return path;
- }
-
- stripped_path = stripped_path.strip_prefix(prefix).unwrap();
- if stripped_path.len() == 0 {
- return borrow::Cow::Borrowed("/");
- }
-
- borrow::Cow::Owned(stripped_path.to_string())
- }
-
fn add_path_prefix<'path, 'prefix>(
path: borrow::Cow<'path, str>,
prefix: &'prefix str,
@@ -73,10 +47,6 @@ impl Settings {
pub fn process_path<'a>(&self, path: &'a str) -> borrow::Cow<'a, str> {
let mut path = borrow::Cow::Borrowed(path);
- if let Some(ref prefix) = self.remove_path_prefix {
- path = Self::remove_path_prefix(path, prefix);
- }
-
if let Some(ref prefix) = self.add_path_prefix {
path = Self::add_path_prefix(path, prefix);
}
@@ -90,26 +60,6 @@ mod tests {
use super::*;
use std::borrow;
- #[test]
- fn remove_path_prefix() {
- let assert_remove = |want: &str, path: &str, prefix: &str| {
- assert_eq!(
- want,
- Settings::remove_path_prefix(borrow::Cow::Borrowed(path), prefix).as_ref(),
- )
- };
-
- assert_remove("/bar", "/foo/bar", "/foo");
- assert_remove("/foo/bar", "/foo/bar", "/baz");
- assert_remove("/bar", "/foo/bar", "/foo/");
- assert_remove("/bar", "/foo/bar", "/foo///");
- assert_remove("/", "/", "/");
- assert_remove("/", "/foo/bar/", "/foo/bar");
- assert_remove("/", "/foo/bar", "/foo/bar");
- assert_remove("/", "/foo/bar", "/foo/bar///");
- assert_remove("/bar", "/bar", "");
- }
-
#[test]
fn add_path_prefix() {
let assert_add = |want: &str, path: &str, prefix: &str| {
diff --git a/src/domain/store.rs b/src/domain/store.rs
index bc0297f..016f87f 100644
--- a/src/domain/store.rs
+++ b/src/domain/store.rs
@@ -181,7 +181,6 @@ mod tests {
url: "bar".to_string(),
branch_name: "baz".to_string(),
},
- remove_path_prefix: None,
add_path_prefix: None,
};
@@ -205,7 +204,6 @@ mod tests {
url: "BAR".to_string(),
branch_name: "BAZ".to_string(),
},
- remove_path_prefix: None,
add_path_prefix: None,
};
diff --git a/src/service/http/tpl/domain.html b/src/service/http/tpl/domain.html
index 9ad1a58..92779c1 100644
--- a/src/service/http/tpl/domain.html
+++ b/src/service/http/tpl/domain.html
@@ -51,23 +51,13 @@ automatically updated too!