From d796895b7590edb7ef243e8378f09f962f599250 Mon Sep 17 00:00:00 2001 From: Thomas Miceli <27960254+thomiceli@users.noreply.github.com> Date: Wed, 14 May 2025 11:51:42 +0200 Subject: [PATCH] Fix filename unescape (#474) --- internal/git/commands.go | 2 +- internal/web/handlers/gist/create.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/git/commands.go b/internal/git/commands.go index f937cff..4ea6a44 100644 --- a/internal/git/commands.go +++ b/internal/git/commands.go @@ -672,7 +672,7 @@ func convertUTF8ToOctal(name string) string { } func convertURLToOctal(name string) string { - decoded, err := url.QueryUnescape(name) + decoded, err := url.PathUnescape(name) if err != nil { return name } diff --git a/internal/web/handlers/gist/create.go b/internal/web/handlers/gist/create.go index b017adc..bbff27d 100644 --- a/internal/web/handlers/gist/create.go +++ b/internal/web/handlers/gist/create.go @@ -52,7 +52,7 @@ func ProcessCreate(ctx *context.Context) error { name = "gistfile" + strconv.Itoa(fileCounter) + ".txt" } - escapedValue, err := url.QueryUnescape(content) + escapedValue, err := url.PathUnescape(content) if err != nil { return ctx.ErrorRes(400, ctx.Tr("error.invalid-character-unescaped"), err) }