Skip to content

Commit

Permalink
chore: restrict the html file (#749)
Browse files Browse the repository at this point in the history
* restrict the html file

* replace spaces with table

* remove space
  • Loading branch information
lujiefsi committed Dec 19, 2022
1 parent bd6ab71 commit 726285e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/resource.go
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"net/url"
"strconv"
"strings"
"time"

"github.com/usememos/memos/api"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 726285e

Please sign in to comment.