duplicate path variable parsing removed
This commit is contained in:
parent
10e3025ddc
commit
e29c7be4fa
14
main.go
14
main.go
@ -80,10 +80,13 @@ func GetAllHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func GetFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
file := vars["file"]
|
||||
fileName, err := url.QueryUnescape(mux.Vars(r)["file"])
|
||||
if err != nil {
|
||||
InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
http.ServeFile(w, r, filepath.Join(LibraryPath, ".songs", file))
|
||||
http.ServeFile(w, r, filepath.Join(LibraryPath, ".songs", fileName))
|
||||
}
|
||||
|
||||
func GetPlaylistHandler(w http.ResponseWriter, r *http.Request) {
|
||||
@ -141,8 +144,9 @@ func GetAllFilesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func GetEncodeFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||
format := mux.Vars(r)["format"]
|
||||
fileName, err := url.QueryUnescape(mux.Vars(r)["file"])
|
||||
vars := mux.Vars(r)
|
||||
format := vars["format"]
|
||||
fileName, err := url.QueryUnescape(vars["file"])
|
||||
if err != nil {
|
||||
InternalServerError(w, err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user