fix encoding url in archive
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@@ -130,6 +131,12 @@ func SendFile(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
path, err := url.QueryUnescape(path)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
decoded, err := base64.StdEncoding.DecodeString(path)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
@@ -137,7 +144,7 @@ func SendFile(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
decodedStr := string(decoded)
|
||||
fmt.Println(decodedStr)
|
||||
fmt.Println("decoded", decodedStr)
|
||||
|
||||
root := config.Instance().GetConfig().DownloadPath
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-chi/cors"
|
||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/handlers"
|
||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
|
||||
middlewares "github.com/marcopeocchi/yt-dlp-web-ui/server/middleware"
|
||||
@@ -54,7 +55,7 @@ func newServer(c serverConfig) *http.Server {
|
||||
|
||||
r := chi.NewRouter()
|
||||
|
||||
r.Use(middlewares.CORS)
|
||||
r.Use(cors.AllowAll().Handler)
|
||||
r.Use(middleware.Logger)
|
||||
|
||||
app := http.FileServer(http.FS(c.frontend))
|
||||
|
||||
Reference in New Issue
Block a user