|
1 | 1 | import asyncio |
2 | 2 | import logging |
3 | 3 | from typing import Annotated, cast |
| 4 | +from urllib.parse import quote |
4 | 5 |
|
5 | 6 | from fastapi import APIRouter, Depends, Header, HTTPException, Request |
6 | 7 | from models_library.api_schemas_storage.storage_schemas import ( |
@@ -202,23 +203,31 @@ async def upload_file( |
202 | 203 | abort_url = ( |
203 | 204 | URL(f"{request.url}") |
204 | 205 | .with_path( |
205 | | - request.app.url_path_for( |
206 | | - "abort_upload_file", |
207 | | - location_id=f"{location_id}", |
208 | | - file_id=file_id, |
209 | | - ) |
| 206 | + quote( |
| 207 | + request.app.url_path_for( |
| 208 | + "abort_upload_file", |
| 209 | + location_id=f"{location_id}", |
| 210 | + file_id=file_id, |
| 211 | + ), |
| 212 | + safe=":/", |
| 213 | + ), |
| 214 | + encoded=True, |
210 | 215 | ) |
211 | 216 | .with_query(user_id=query_params.user_id) |
212 | 217 | ) |
213 | 218 |
|
214 | 219 | complete_url = ( |
215 | 220 | URL(f"{request.url}") |
216 | 221 | .with_path( |
217 | | - request.app.url_path_for( |
218 | | - "complete_upload_file", |
219 | | - location_id=f"{location_id}", |
220 | | - file_id=file_id, |
221 | | - ) |
| 222 | + quote( |
| 223 | + request.app.url_path_for( |
| 224 | + "complete_upload_file", |
| 225 | + location_id=f"{location_id}", |
| 226 | + file_id=file_id, |
| 227 | + ), |
| 228 | + safe=":/", |
| 229 | + ), |
| 230 | + encoded=True, |
222 | 231 | ) |
223 | 232 | .with_query(user_id=query_params.user_id) |
224 | 233 | ) |
@@ -273,12 +282,16 @@ async def complete_upload_file( |
273 | 282 | route = ( |
274 | 283 | URL(f"{request.url}") |
275 | 284 | .with_path( |
276 | | - request.app.url_path_for( |
277 | | - "is_completed_upload_file", |
278 | | - location_id=f"{location_id}", |
279 | | - file_id=file_id, |
280 | | - future_id=task.get_name(), |
281 | | - ) |
| 285 | + quote( |
| 286 | + request.app.url_path_for( |
| 287 | + "is_completed_upload_file", |
| 288 | + location_id=f"{location_id}", |
| 289 | + file_id=file_id, |
| 290 | + future_id=task.get_name(), |
| 291 | + ), |
| 292 | + safe=":/", |
| 293 | + ), |
| 294 | + encoded=True, |
282 | 295 | ) |
283 | 296 | .with_query(user_id=query_params.user_id) |
284 | 297 | ) |
|
0 commit comments