summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2023-09-21 10:51:30 +0200
committerBrian Picciano <mediocregopher@gmail.com>2023-09-21 10:51:30 +0200
commitba2d581975c3b1b63f1794d3bcd912ad12e6f15b (patch)
treeb9996e729dcff82c5e7c54a672d43e45115e8627
parent78bbfa42fa1159bce12c2c1d29eeb0bb9a8a2f75 (diff)
Fix gemini gateway proxying to work with gateways like tildeverse's
-rw-r--r--src/gmi/gemtext.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gmi/gemtext.go b/src/gmi/gemtext.go
index 3e5f6fc..884635c 100644
--- a/src/gmi/gemtext.go
+++ b/src/gmi/gemtext.go
@@ -7,7 +7,6 @@ import (
"io"
"net/url"
"path"
- "path/filepath"
"regexp"
"strings"
)
@@ -50,11 +49,10 @@ func GemtextToMarkdown(dst io.Writer, src io.Reader, gmiGateway *url.URL) error
}
if u.Scheme == "gemini" && gmiGateway != nil {
-
- newU := *gmiGateway
- newU.Path = filepath.Join(newU.Path, u.Host, u.Path)
- newU.RawQuery = u.RawQuery
- u = &newU
+ newUStr := gmiGateway.String() + u.Host + u.Path
+ if u, err = url.Parse(newUStr); err != nil {
+ return fmt.Errorf("parsing proxied URL %q: %w", newUStr, err)
+ }
}
isImg := hasImgExt(u.Path)