aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-06-13 07:16:54 +0000
committerFuwn <[email protected]>2022-06-13 07:17:07 +0000
commit1fc3778ca790d39c99833cc49ce3846d6270e48b (patch)
tree7a87478653eed90104570cd6f779bc4162dde0e7 /src
parentdeps(germ): bump and use new-style ast (diff)
downloadseptember-1fc3778ca790d39c99833cc49ce3846d6270e48b.tar.xz
september-1fc3778ca790d39c99833cc49ce3846d6270e48b.zip
fix(gemini_to_html): circumlunar.space style urls
Diffstat (limited to 'src')
-rw-r--r--src/gemini_to_html.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gemini_to_html.rs b/src/gemini_to_html.rs
index 7e0d6e2..777381a 100644
--- a/src/gemini_to_html.rs
+++ b/src/gemini_to_html.rs
@@ -36,6 +36,7 @@ fn link_from_host_href(url: &Url, href: &str) -> String {
)
}
+#[allow(clippy::too_many_lines)]
pub fn gemini_to_html(
response: &gmi::protocol::Response,
url: &Url,
@@ -56,7 +57,9 @@ pub fn gemini_to_html(
} => {
let mut href = to.clone();
- if href.starts_with('/') || !href.contains("://") {
+ if !href.starts_with("gemini://") && !href.starts_with('/') {
+ href = format!("./{}", href);
+ } else if href.starts_with('/') || !href.contains("://") {
href = link_from_host_href(url, &href);
}