Skip to content

Commit 5b01e5e

Browse files
authored
feat: update storage url scheme (#200)
1 parent 7e23777 commit 5b01e5e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

indico/queries/storage.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import io
33
import json
44
from typing import Dict, List
5-
from urllib.request import Request
65

76
from indico.client.request import GraphQLRequest, HTTPMethod, HTTPRequest, RequestChain
87
from indico.errors import IndicoInputError, IndicoRequestError
98

10-
URL_PREFIX = "indico-file:///storage"
9+
URL_SCHEME_BLOB = "indico-blob"
10+
URL_SCHEME_LEGACY = "indico-file"
11+
URL_PREFIX = f"{URL_SCHEME_BLOB}:///storage"
1112

1213

1314
class RetrieveStorageObject(HTTPRequest):
@@ -38,7 +39,11 @@ def __init__(self, storage_object):
3839
else:
3940
url = storage_object
4041

41-
url = url.replace("indico-file://", "")
42+
if url.startswith(URL_SCHEME_BLOB):
43+
url = url.replace(f"{URL_SCHEME_BLOB}://", "")
44+
else:
45+
url = url.replace(f"{URL_SCHEME_LEGACY}://", "")
46+
4247
super().__init__(method=HTTPMethod.GET, path=url)
4348

4449

0 commit comments

Comments
 (0)