fix invalid assets path when use webroot (#448)

Co-authored-by: hulb <hulb@RD-NeoHu.netis.com.cn>
This commit is contained in:
hulb 2022-07-08 17:26:37 +08:00 committed by GitHub
parent f000f11bfa
commit 7e1824a8b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,9 +14,10 @@ import (
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/go-shiori/shiori/internal/model"
"github.com/go-shiori/warc"
"github.com/julienschmidt/httprouter"
"github.com/go-shiori/shiori/internal/model"
)
// serveFile is handler for general file request
@ -24,6 +25,7 @@ func (h *handler) serveFile(w http.ResponseWriter, r *http.Request, ps httproute
rootPath := strings.Trim(h.RootPath, "/")
urlPath := strings.Trim(r.URL.Path, "/")
filePath := strings.TrimPrefix(urlPath, rootPath)
filePath = strings.Trim(filePath, "/")
err := serveFile(w, filePath, true)
checkError(err)