clean up
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,6 +1,6 @@
|
|||||||
*.db
|
*.db
|
||||||
*.db-wal
|
*db-wal
|
||||||
*.db-shm
|
*db-shm
|
||||||
*.sql
|
*.sql
|
||||||
cmd/scanner/scanner
|
cmd/scanner/scanner
|
||||||
cmd/server/server
|
cmd/server/server
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ func TestFirstExisting(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc // pin
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
actu := firstExisting(tc.or, tc.values...)
|
actu := firstExisting(tc.or, tc.values...)
|
||||||
if actu != tc.exp {
|
if actu != tc.exp {
|
||||||
t.Errorf("expected %q, got %q", tc.exp, actu)
|
t.Errorf("expected %q, got %q", tc.exp, actu)
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ func New(db *db.DB, musicPath string, listenAddr string) *Server {
|
|||||||
router.HandleFunc("/musicFolderSettings.view", func(w http.ResponseWriter, r *http.Request) {
|
router.HandleFunc("/musicFolderSettings.view", func(w http.ResponseWriter, r *http.Request) {
|
||||||
// jamstash seems to call "musicFolderSettings.view" to start a scan. notice
|
// jamstash seems to call "musicFolderSettings.view" to start a scan. notice
|
||||||
// that there is no "/rest/" prefix, so i doesn't fit in with the nice router,
|
// that there is no "/rest/" prefix, so i doesn't fit in with the nice router,
|
||||||
// instead lets redirect to down there and use the scan endpoint
|
|
||||||
// custom handler, middleware. etc setup that we've got in `SetupSubsonic()`.
|
// custom handler, middleware. etc setup that we've got in `SetupSubsonic()`.
|
||||||
|
// instead lets redirect to down there and use the scan endpoint
|
||||||
redirectTo := fmt.Sprintf("/rest/startScan.view?%s", r.URL.Query().Encode())
|
redirectTo := fmt.Sprintf("/rest/startScan.view?%s", r.URL.Query().Encode())
|
||||||
http.Redirect(w, r, redirectTo, http.StatusMovedPermanently)
|
http.Redirect(w, r, redirectTo, http.StatusMovedPermanently)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user