parent
090e753923
commit
b116418f05
13 changed files with 45 additions and 28 deletions
|
@ -6,7 +6,6 @@ package public
|
|||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
@ -14,6 +13,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/httpcache"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
// Options represents the available options to configure the handler.
|
||||
|
@ -103,7 +103,7 @@ func setWellKnownContentType(w http.ResponseWriter, file string) {
|
|||
|
||||
func (opts *Options) handle(w http.ResponseWriter, req *http.Request, fs http.FileSystem, file string) bool {
|
||||
// use clean to keep the file is a valid path with no . or ..
|
||||
f, err := fs.Open(path.Clean(file))
|
||||
f, err := fs.Open(util.CleanPath(file))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue