mirror of
https://github.com/JuLi0n21/pwa-player.git
synced 2026-04-19 15:30:05 +00:00
file songs file path form pasted dir
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/juli0n21/go-osu-parser/parser"
|
"github.com/juli0n21/go-osu-parser/parser"
|
||||||
@@ -60,7 +59,7 @@ func initDB(connectionString string, osuDb *parser.OsuDB, osuroot string) (*sql.
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
collectionDB, err := parser.ParseCollectionsDB(path.Join(osuRoot, "collection.db"))
|
collectionDB, err := parser.ParseCollectionsDB(filepath.Join(osuRoot, "collection.db"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
v1 "backend/gen"
|
v1 "backend/gen"
|
||||||
"backend/internal/db"
|
"backend/internal/db"
|
||||||
@@ -248,7 +249,7 @@ func (s *Server) songFile(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.Open(s.OsuDir + "Songs/" + string(filename))
|
file, err := os.Open(filepath.Join(s.OsuDir, "Songs", string(filename)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
http.Error(w, ErrFileNotFound.Error(), http.StatusNotFound)
|
http.Error(w, ErrFileNotFound.Error(), http.StatusNotFound)
|
||||||
@@ -280,7 +281,7 @@ func (s *Server) imageFile(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
http.ServeFile(w, r, s.OsuDir+"Songs/"+string(filename))
|
http.ServeFile(w, r, filepath.Join(s.OsuDir, "Songs", string(filename)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) callback(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) callback(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user