File tree Expand file tree Collapse file tree 6 files changed +24
-8
lines changed Expand file tree Collapse file tree 6 files changed +24
-8
lines changed Original file line number Diff line number Diff line change
1
+ # 0.4.7
2
+
3
+ ## New Features
4
+
5
+ * ` sign ` will now avoid signing URLs that have already been signed.
6
+
1
7
# 0.4.6
2
8
3
9
## New Features
Original file line number Diff line number Diff line change 6
6
import warnings
7
7
8
8
from functools import singledispatch
9
- from urllib .parse import urlparse
9
+ from urllib .parse import urlparse , parse_qs
10
10
import requests
11
11
from pydantic import BaseModel , Field
12
12
from pystac import Asset , Item , ItemCollection
@@ -126,6 +126,11 @@ def sign_url(url: str) -> str:
126
126
if not parsed_url .netloc .endswith (BLOB_STORAGE_DOMAIN ):
127
127
return url
128
128
129
+ parsed_qs = parse_qs (parsed_url .query )
130
+ if set (parsed_qs ) & {"st" , "se" , "sp" }:
131
+ # looks like we've already signed it
132
+ return url
133
+
129
134
account , container = parse_blob_url (parsed_url )
130
135
token = get_token (account , container )
131
136
return token .sign (url ).href
Original file line number Diff line number Diff line change 1
1
"""Library version"""
2
2
3
- __version__ = "0.4.6 "
3
+ __version__ = "0.4.7 "
Original file line number Diff line number Diff line change 1
- black == 21.10b0
1
+ black == 22.6.0
2
2
flake8 == 4.0.1
3
- ipdb == 0.13.7
4
- mypy == 0.910
5
- types-requests == 2.26.0
6
- setuptools == 58.5.3
3
+ ipdb == 0.13.9
4
+ mypy == 0.961
5
+ types-requests == 2.28.1
6
+ setuptools == 63.1.0
Original file line number Diff line number Diff line change 1
1
[metadata]
2
2
name = planetary-computer
3
- version = 0.4.6
3
+ version = 0.4.7
4
4
license_file = LICENSE
5
5
author = microsoft
6
6
author_email = planetarycomputer@microsoft.com
Original file line number Diff line number Diff line change @@ -283,3 +283,8 @@ def test_is_fsspec_url(self) -> None:
283
283
284
284
asset = Asset ("adlfs://my-container/my/path.ext" )
285
285
self .assertFalse (is_fsspec_asset (asset ))
286
+
287
+ def test_no_double_sign_url (self ) -> None :
288
+ result = pc .sign (SENTINEL_THUMBNAIL )
289
+ result2 = pc .sign (result )
290
+ assert result == result2
You can’t perform that action at this time.
0 commit comments