Escape URL in filer (#236)

Also see #228.
This commit is contained in:
Pieter Noordhuis 2023-03-08 14:27:05 +01:00 committed by GitHub
parent da4b58a897
commit 65b3f998ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"path"
"strings"
@ -53,7 +54,7 @@ func (w *WorkspaceFilesClient) Write(ctx context.Context, name string, reader io
overwrite := slices.Contains(mode, OverwriteIfExists)
urlPath := fmt.Sprintf(
"/api/2.0/workspace-files/import-file/%s?overwrite=%t",
strings.TrimLeft(absPath, "/"),
url.QueryEscape(strings.TrimLeft(absPath, "/")),
overwrite,
)