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
commit347d2d56a0364b610c7e3499e44d211b2b8f7911 (patch)
tree151f8b1583e115ffca959d94c4dc21022c07bb34 /src
parentdeps(germ): bump and use new-style ast (diff)
downloadseptember-347d2d56a0364b610c7e3499e44d211b2b8f7911.tar.xz
september-347d2d56a0364b610c7e3499e44d211b2b8f7911.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);
}