pluginshared: Cleanup request path in tests (#37299)

This commit is contained in:
Radek Simko 2025-07-07 17:01:32 +01:00 committed by GitHub
parent 6740c5e3d1
commit 3e8a08609d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,7 @@ import (
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"testing"
"time"
)
@ -67,7 +68,8 @@ func (h *testHTTPHandler) Handle(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(testManifest))
}
default:
fileToSend, err := os.Open(fmt.Sprintf("testdata/%s", r.URL.Path))
path := filepath.Clean(r.URL.Path)
fileToSend, err := os.Open(fmt.Sprintf("testdata/%s", path))
if err == nil {
io.Copy(w, fileToSend)
return