Skip to content

Commit a703b73

Browse files
authored
feat(offline_download): filter empty URLs in offline download requests (#948)
1 parent e458f2a commit a703b73

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/handles/offline_download.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package handles
22

33
import (
4+
"strings"
5+
46
_115 "github.com/OpenListTeam/OpenList/v4/drivers/115"
57
_115_open "github.com/OpenListTeam/OpenList/v4/drivers/115_open"
68
"github.com/OpenListTeam/OpenList/v4/drivers/pikpak"
@@ -406,8 +408,14 @@ func AddOfflineDownload(c *gin.Context) {
406408
}
407409
var tasks []task.TaskExtensionInfo
408410
for _, url := range req.Urls {
411+
// Filter out empty lines and whitespace-only strings
412+
trimmedUrl := strings.TrimSpace(url)
413+
if trimmedUrl == "" {
414+
continue
415+
}
416+
409417
t, err := tool.AddURL(c, &tool.AddURLArgs{
410-
URL: url,
418+
URL: trimmedUrl,
411419
DstDirPath: reqPath,
412420
Tool: req.Tool,
413421
DeletePolicy: tool.DeletePolicy(req.DeletePolicy),

0 commit comments

Comments
 (0)