mirror of
https://github.com/usememos/memos.git
synced 2026-01-07 00:45:32 +08:00
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
1 changed files with 5 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue