Add request IP to get_direct_download_url method
This commit is contained in:
parent
ad61df66c5
commit
56fbbcf7cf
8 changed files with 13 additions and 11 deletions
|
@ -119,7 +119,7 @@ class _CloudStorage(BaseStorageV2):
|
|||
def get_supports_resumable_downloads(self):
|
||||
return True
|
||||
|
||||
def get_direct_download_url(self, path, expires_in=60, requires_cors=False, head=False):
|
||||
def get_direct_download_url(self, path, request_ip=None, expires_in=60, requires_cors=False, head=False):
|
||||
self._initialize_cloud_conn()
|
||||
path = self._init_path(path)
|
||||
k = self._key_class(self._cloud_bucket, path)
|
||||
|
@ -568,11 +568,11 @@ class RadosGWStorage(_CloudStorage):
|
|||
storage_path, bucket_name, access_key, secret_key)
|
||||
|
||||
# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
|
||||
def get_direct_download_url(self, path, expires_in=60, requires_cors=False, head=False):
|
||||
def get_direct_download_url(self, path, request_ip=None, expires_in=60, requires_cors=False, head=False):
|
||||
if requires_cors:
|
||||
return None
|
||||
|
||||
return super(RadosGWStorage, self).get_direct_download_url(path, expires_in, requires_cors,
|
||||
return super(RadosGWStorage, self).get_direct_download_url(path, request_ip, expires_in, requires_cors,
|
||||
head)
|
||||
|
||||
# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
|
||||
|
|
|
@ -56,9 +56,9 @@ class DistributedStorage(StoragePaths):
|
|||
cancel_chunked_upload = _location_aware(BaseStorageV2.cancel_chunked_upload)
|
||||
|
||||
|
||||
def get_direct_download_url(self, locations, path, expires_in=600, requires_cors=False,
|
||||
def get_direct_download_url(self, locations, path, request_ip=None, expires_in=600, requires_cors=False,
|
||||
head=False):
|
||||
download_url = self._get_direct_download_url(locations, path, expires_in, requires_cors, head)
|
||||
download_url = self._get_direct_download_url(locations, path, request_ip, expires_in, requires_cors, head)
|
||||
if download_url is None:
|
||||
return None
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class FakeStorage(BaseStorageV2):
|
|||
def _init_path(self, path=None, create=False):
|
||||
return path
|
||||
|
||||
def get_direct_download_url(self, path, expires_in=60, requires_cors=False, head=False):
|
||||
def get_direct_download_url(self, path, request_ip=None, expires_in=60, requires_cors=False, head=False):
|
||||
try:
|
||||
if self.get_content('supports_direct_download') == 'true':
|
||||
return 'http://somefakeurl?goes=here'
|
||||
|
|
|
@ -147,7 +147,7 @@ class SwiftStorage(BaseStorage):
|
|||
logger.exception('Could not head object at path %s: %s', path, ex)
|
||||
return None
|
||||
|
||||
def get_direct_download_url(self, object_path, expires_in=60, requires_cors=False, head=False):
|
||||
def get_direct_download_url(self, object_path, request_ip=None, expires_in=60, requires_cors=False, head=False):
|
||||
if requires_cors:
|
||||
return None
|
||||
|
||||
|
|
Reference in a new issue