chore: restrict the html file (#749)

* restrict the html file

* replace spaces with table

* remove space
This commit is contained in:
lujiefsi 2022-12-19 18:26:50 +08:00 committed by GitHub
parent bd6ab71d41
commit 726285e634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ import (
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/usememos/memos/api"
@ -42,6 +43,10 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
}
filename := file.Filename
if strings.HasSuffix(filename, ".html") {
return echo.NewHTTPError(http.StatusBadRequest, "html file is not allowed")
}
filetype := file.Header.Get("Content-Type")
size := file.Size
src, err := file.Open()