|
|
@ -12,6 +12,7 @@ import (
|
|
|
|
"math/rand"
|
|
|
|
"math/rand"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"path"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
@ -309,10 +310,7 @@ func listVendorDynamicMovie(ctx context.Context, reqUser *op.User, room *op.Room
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("load alist server id error: %w", err)
|
|
|
|
return nil, fmt.Errorf("load alist server id error: %w", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
newPath, err := url.JoinPath(truePath, subPath)
|
|
|
|
newPath := path.Join(truePath, subPath)
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, fmt.Errorf("join path error: %w", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// check new path is in parent path
|
|
|
|
// check new path is in parent path
|
|
|
|
if !strings.HasPrefix(newPath, truePath) {
|
|
|
|
if !strings.HasPrefix(newPath, truePath) {
|
|
|
|
return nil, fmt.Errorf("sub path is not in parent path")
|
|
|
|
return nil, fmt.Errorf("sub path is not in parent path")
|
|
|
|