Fix filename unescape (#474)

This commit is contained in:
Thomas Miceli 2025-05-14 11:51:42 +02:00 committed by GitHub
parent 5542497622
commit d796895b75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -672,7 +672,7 @@ func convertUTF8ToOctal(name string) string {
} }
func convertURLToOctal(name string) string { func convertURLToOctal(name string) string {
decoded, err := url.QueryUnescape(name) decoded, err := url.PathUnescape(name)
if err != nil { if err != nil {
return name return name
} }

View File

@ -52,7 +52,7 @@ func ProcessCreate(ctx *context.Context) error {
name = "gistfile" + strconv.Itoa(fileCounter) + ".txt" name = "gistfile" + strconv.Itoa(fileCounter) + ".txt"
} }
escapedValue, err := url.QueryUnescape(content) escapedValue, err := url.PathUnescape(content)
if err != nil { if err != nil {
return ctx.ErrorRes(400, ctx.Tr("error.invalid-character-unescaped"), err) return ctx.ErrorRes(400, ctx.Tr("error.invalid-character-unescaped"), err)
} }