Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SnapshotSAS]Delete Redundant code
The removed code is for another feature.
  • Loading branch information
xiafu-msft committed Aug 20, 2019
commit 4118167eb82ba452904f802ee35d091303e73819
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ class QueryStringConstants(object):
END_RK = 'erk'
SIGNED_RESOURCE_TYPES = 'srt'
SIGNED_SERVICES = 'ss'
SIGNED_TIMESTAMP = 'snapshot'
SIGNED_OID = 'skoid'
SIGNED_TID = 'sktid'
SIGNED_KEY_START = 'skt'
SIGNED_KEY_EXPIRY = 'ske'
SIGNED_KEY_SERVICE = 'sks'
SIGNED_KEY_VERSION = 'skv'

@staticmethod
def to_list():
Expand Down Expand Up @@ -216,5 +209,3 @@ def get_value_to_append(query):

def get_token(self):
return '&'.join(['{0}={1}'.format(n, url_quote(v)) for n, v in self.query_dict.items() if v is not None])


Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
QueryStringConstants


class BlobQueryStringConstants(object):
SIGNED_TIMESTAMP = 'snapshot'


class BlobSharedAccessSignature(SharedAccessSignature):
'''
Provides a factory for creating blob and container access
Expand Down Expand Up @@ -187,7 +191,7 @@ def __init__(self):
super(_BlobSharedAccessHelper, self).__init__()

def add_timestamp(self, timestamp):
self._add_query(QueryStringConstants.SIGNED_TIMESTAMP, timestamp)
self._add_query(BlobQueryStringConstants.SIGNED_TIMESTAMP, timestamp)

def get_value_to_append(self, query):
return_value = self.query_dict.get(query) or ''
Expand Down Expand Up @@ -230,7 +234,7 @@ def add_resource_signature(self, account_name, account_key, path, user_delegatio
self.get_value_to_append(QueryStringConstants.SIGNED_PROTOCOL) +
self.get_value_to_append(QueryStringConstants.SIGNED_VERSION) +
self.get_value_to_append(QueryStringConstants.SIGNED_RESOURCE) +
self.get_value_to_append(QueryStringConstants.SIGNED_TIMESTAMP) +
self.get_value_to_append(BlobQueryStringConstants.SIGNED_TIMESTAMP) +
self.get_value_to_append(QueryStringConstants.SIGNED_CACHE_CONTROL) +
self.get_value_to_append(QueryStringConstants.SIGNED_CONTENT_DISPOSITION) +
self.get_value_to_append(QueryStringConstants.SIGNED_CONTENT_ENCODING) +
Expand All @@ -248,6 +252,6 @@ def add_resource_signature(self, account_name, account_key, path, user_delegatio
def get_token(self):
# a conscious decision was made to exclude the timestamp in the generated token
# this is to avoid having two snapshot ids in the query parameters when the user appends the snapshot timestamp
exclude = [QueryStringConstants.SIGNED_TIMESTAMP]
exclude = [BlobQueryStringConstants.SIGNED_TIMESTAMP]
return '&'.join(['{0}={1}'.format(n, url_quote(v))
for n, v in self.query_dict.items() if v is not None and n not in exclude])