diff --git a/main.go b/main.go index 2ae3f25..d036229 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "fmt" "math/rand" "net/http" + "net/url" "os" "os/exec" "path/filepath" @@ -140,8 +141,12 @@ func GetAllFilesHandler(w http.ResponseWriter, r *http.Request) { } func GetEncodeFileHandler(w http.ResponseWriter, r *http.Request) { - fileName := mux.Vars(r)["file"] format := mux.Vars(r)["format"] + fileName, err := url.QueryUnescape(mux.Vars(r)["file"]) + if err != nil { + InternalServerError(w, err) + return + } inputFilePath := filepath.Join(LibraryPath, ".songs", fileName) outputFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("%d.%s", rand.Int(), format))