Skip to content

Commit 29ca24b

Browse files
committed
set additional subresource from op_metadata.
1 parent 6f9ab9e commit 29ca24b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

alibabacloud_oss_v2/_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ def build_request_context(self, op_input: OperationInput, options: _Options, inn
268268
if (expiration_time := op_input.op_metadata.get('expiration_time', None)) is not None:
269269
context.expiration_time = expiration_time
270270

271+
context.sub_resource = op_input.op_metadata.get("sub-resource", [])
272+
271273
return context
272274

273275
def retry_max_attempts(self, options: _Options) -> int:

alibabacloud_oss_v2/signer/v1.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ def _calc_string_to_sign(self, signing_ctx: SigningContext, date: Optional[str]
166166
value = unquote(value)
167167
if key in self._subresource_key_set:
168168
key_val_pairs.append((key, value))
169+
elif key in signing_ctx.sub_resource:
170+
key_val_pairs.append((key, value))
171+
169172
sorted_key_vals = []
170173
for key, value in sorted(key_val_pairs):
171174
if len(value) > 0:

alibabacloud_oss_v2/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def __init__(
327327
self.string_to_sign = ''
328328
self.additional_headers = additional_headers
329329
self.expiration_time: Optional[datetime.datetime] = None
330+
self.sub_resource: Optional[str] = []
330331

331332

332333
class Signer(abc.ABC):

0 commit comments

Comments
 (0)