fix: create parent dirs for downloads with subdirectory paths
Some archive.org file names include directory prefixes (e.g. "ZERO-G - Deepest India/vocal.iso"). MkdirAll only created the output root, not intermediate directories. Added filepath.Dir(MkdirAll) in both downloadFile (CLI) and handleAPIDownload (web).
This commit is contained in:
@@ -189,6 +189,8 @@ func handleAPIDownload(w http.ResponseWriter, r *http.Request) {
|
||||
jobIDs = append(jobIDs, jobID)
|
||||
|
||||
go func(j downloadJob, s *downloadState) {
|
||||
os.MkdirAll(filepath.Dir(j.OutPath), 0755)
|
||||
|
||||
client := &http.Client{Timeout: 0}
|
||||
req, _ := http.NewRequest("GET", j.URL, nil)
|
||||
req.Header.Set("User-Agent", userAgent)
|
||||
|
||||
Reference in New Issue
Block a user