This commit is contained in:
Simon Ding
2025-04-29 15:55:11 +08:00
parent 3eb1f37387
commit 3a73d0c33e
4 changed files with 19 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"polaris/db"
"strings"
"polaris/log"
"polaris/pkg/alist"
@@ -52,10 +53,17 @@ func (s *Server) AddStorage(c *gin.Context) (interface{}, error) {
if err != nil {
return nil, err
}
if !strings.HasSuffix(in.TvPath, string(os.PathSeparator)) {
in.TvPath = in.TvPath + string(os.PathSeparator)
}
_, err = os.Stat(in.MoviePath)
if err != nil {
return nil, err
}
if !strings.HasSuffix(in.MoviePath, string(os.PathSeparator)) {
in.MoviePath = in.MoviePath + string(os.PathSeparator)
}
}
log.Infof("received add storage input: %v", in)
err := s.db.AddStorage(&in)