Fix gemini gateway proxying to work with gateways like tildeverse's
This commit is contained in:
parent
78bbfa42fa
commit
ba2d581975
@ -7,7 +7,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -50,11 +49,10 @@ func GemtextToMarkdown(dst io.Writer, src io.Reader, gmiGateway *url.URL) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
if u.Scheme == "gemini" && gmiGateway != nil {
|
if u.Scheme == "gemini" && gmiGateway != nil {
|
||||||
|
newUStr := gmiGateway.String() + u.Host + u.Path
|
||||||
newU := *gmiGateway
|
if u, err = url.Parse(newUStr); err != nil {
|
||||||
newU.Path = filepath.Join(newU.Path, u.Host, u.Path)
|
return fmt.Errorf("parsing proxied URL %q: %w", newUStr, err)
|
||||||
newU.RawQuery = u.RawQuery
|
}
|
||||||
u = &newU
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isImg := hasImgExt(u.Path)
|
isImg := hasImgExt(u.Path)
|
||||||
|
Loading…
Reference in New Issue
Block a user