Spaces:
Runtime error
Runtime error
Update remote_uploader.py
Browse files- remote_uploader.py +4 -4
remote_uploader.py
CHANGED
@@ -22,8 +22,8 @@ class WebSocketFileUploader:
|
|
22 |
async def connect_and_upload(self, upload_dir):
|
23 |
"""连接到 WebSocket 服务器并上传文件"""
|
24 |
# 将 HTTP URL 转换为 WebSocket URL
|
25 |
-
# 清理URL
|
26 |
-
clean_server_url = self.server_url.strip()
|
27 |
ws_url = clean_server_url.replace('http://', 'ws://').replace('https://', 'wss://').rstrip('/')
|
28 |
ws_url += f'/ws/upload/{self.space_id}?token={self.api_key}'
|
29 |
|
@@ -145,8 +145,8 @@ class WebSocketFileUploader:
|
|
145 |
return False
|
146 |
|
147 |
# 构建完整的 API 端点 URL
|
148 |
-
# 清理URL
|
149 |
-
clean_server_url = self.server_url.strip()
|
150 |
upload_url = f"{clean_server_url.rstrip('/')}/api/remote_upload"
|
151 |
|
152 |
# 准备请求头
|
|
|
22 |
async def connect_and_upload(self, upload_dir):
|
23 |
"""连接到 WebSocket 服务器并上传文件"""
|
24 |
# 将 HTTP URL 转换为 WebSocket URL
|
25 |
+
# 清理URL,移除可能的换行符、空格和反引号
|
26 |
+
clean_server_url = self.server_url.strip().replace('`', '') # 移除反引号
|
27 |
ws_url = clean_server_url.replace('http://', 'ws://').replace('https://', 'wss://').rstrip('/')
|
28 |
ws_url += f'/ws/upload/{self.space_id}?token={self.api_key}'
|
29 |
|
|
|
145 |
return False
|
146 |
|
147 |
# 构建完整的 API 端点 URL
|
148 |
+
# 清理URL,移除可能的换行符、空格和反引号
|
149 |
+
clean_server_url = self.server_url.strip().replace('`', '') # 移除反引号
|
150 |
upload_url = f"{clean_server_url.rstrip('/')}/api/remote_upload"
|
151 |
|
152 |
# 准备请求头
|