Skip to content

Commit

Permalink
sanitize url
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Jul 26, 2021
1 parent ca8d3f1 commit c09fb17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rwtxt.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import (
"time"

"github.com/gorilla/websocket"
"github.com/microcosm-cc/bluemonday"
"github.com/schollz/documentsimilarity"
log "github.com/schollz/logger"
"github.com/schollz/rwtxt/pkg/db"
"github.com/schollz/rwtxt/pkg/utils"
)

var pbclean = bluemonday.UGCPolicy()

const DefaultBind = ":8152"

type RWTxt struct {
Expand Down Expand Up @@ -216,7 +219,7 @@ Disallow: /`))
return rwt.handleStatic(w, r)
}

fields := strings.Split(r.URL.Path, "/")
fields := strings.Split(pbclean.Sanitize(r.URL.Path), "/")

tr := NewTemplateRender(rwt)
tr.Domain = "public"
Expand Down

0 comments on commit c09fb17

Please sign in to comment.