Skip to content

Commit ce324e6

Browse files
committed
Fixed remote API client download URL characters bug
1 parent 3044301 commit ce324e6

4 files changed

Lines changed: 258 additions & 147 deletions

File tree

audio_separator/remote/api_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
import json
55
from typing import Optional, List, Dict
6+
from urllib.parse import quote
67

78
import requests
89

@@ -319,7 +320,9 @@ def download_file(self, task_id: str, filename: str, output_path: Optional[str]
319320
output_path = filename
320321

321322
try:
322-
response = self.session.get(f"{self.api_url}/download/{task_id}/{filename}", timeout=60)
323+
# URL encode the filename to handle spaces and special characters
324+
encoded_filename = quote(filename, safe='')
325+
response = self.session.get(f"{self.api_url}/download/{task_id}/{encoded_filename}", timeout=60)
323326
response.raise_for_status()
324327

325328
with open(output_path, "wb") as f:

0 commit comments

Comments
 (0)