1- from typing import Dict , List , Optional , Union
1+ from typing import List , Union
22
33import pystac
44
@@ -15,28 +15,27 @@ def create_item(
1515 ) -> Union [List [pystac .Item ], WaitTaskResult ]:
1616 from gbif_pkg .gbif_tools import create_item
1717
18- storage_options : Optional [Dict [str , str ]]
19- asset_extra_fields : Optional [Dict [str , Optional [Dict [str , str ]]]]
20-
2118 storage , path = storage_factory .get_storage_for_file (asset_uri )
2219 if isinstance (storage , BlobStorage ):
23- href = f"https://{ storage .storage_account_name } .blob.core.windows.net/{ storage .container_name } /{ path } "
20+ az_uri = f"az://{ storage .container_name } /{ path } " .rstrip ("/" )
21+ https_href = f"https://{ storage .storage_account_name } .blob.core.windows.net/{ storage .container_name } /{ path } " .rstrip ("/" )
2422 storage_options = dict (account_name = storage .storage_account_name )
2523 asset_extra_fields = {
2624 "table:storage_options" : storage_options ,
2725 "msft:partition_info" : {
2826 "is_partitioned" : True
2927 }
3028 }
29+ item = create_item (
30+ az_uri ,
31+ storage_options = storage_options ,
32+ asset_extra_fields = asset_extra_fields ,
33+ asset_href_override = https_href ,
34+ )
3135 else :
32- href = storage .get_url (path )
33- storage_options = dict ()
34- asset_extra_fields = None
35-
36- href = href .rstrip ("/" )
37-
38- item = create_item (
39- href , storage_options = storage_options , asset_extra_fields = asset_extra_fields
40- )
36+ href = storage .get_url (path ).rstrip ("/" )
37+ item = create_item (
38+ href , storage_options = dict (), asset_extra_fields = None
39+ )
4140
4241 return [item ]
0 commit comments