chore: restrict the html file (#749)
* restrict the html file * replace spaces with table * remove space
This commit is contained in:
parent
bd6ab71d41
commit
726285e634
@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/usememos/memos/api"
|
"github.com/usememos/memos/api"
|
||||||
@ -42,6 +43,10 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename := file.Filename
|
filename := file.Filename
|
||||||
|
if strings.HasSuffix(filename, ".html") {
|
||||||
|
return echo.NewHTTPError(http.StatusBadRequest, "html file is not allowed")
|
||||||
|
}
|
||||||
|
|
||||||
filetype := file.Header.Get("Content-Type")
|
filetype := file.Header.Get("Content-Type")
|
||||||
size := file.Size
|
size := file.Size
|
||||||
src, err := file.Open()
|
src, err := file.Open()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user