fix(strm): encoded path is ineffective (#951)

This commit is contained in:
Seven
2025-08-02 00:23:18 +08:00
committed by GitHub
parent a703b736c9
commit 05ff7908f2

View File

@ -127,20 +127,16 @@ func (d *Strm) list(ctx context.Context, dst, sub string, args *fs.ListArgs) ([]
} }
func (d *Strm) getLink(ctx context.Context, path string) string { func (d *Strm) getLink(ctx context.Context, path string) string {
var encodePath string finalPath := path
if d.EncodePath { if d.EncodePath {
encodePath = utils.EncodePath(path, true) finalPath = utils.EncodePath(path, true)
} }
if d.EnableSign { if d.EnableSign {
signPath := sign.Sign(path) signPath := sign.Sign(path)
if len(encodePath) > 0 { finalPath = fmt.Sprintf("%s?sign=%s", finalPath, signPath)
path = fmt.Sprintf("%s?sign=%s", encodePath, signPath)
} else {
path = fmt.Sprintf("%s?sign=%s", path, signPath)
}
} }
if d.LocalModel { if d.LocalModel {
return path return finalPath
} }
apiUrl := d.SiteUrl apiUrl := d.SiteUrl
if len(apiUrl) > 0 { if len(apiUrl) > 0 {
@ -151,5 +147,5 @@ func (d *Strm) getLink(ctx context.Context, path string) string {
return fmt.Sprintf("%s/d%s", return fmt.Sprintf("%s/d%s",
apiUrl, apiUrl,
path) finalPath)
} }