MCPcopy Create free account
hub / github.com/s3tools/s3cmd / format_uri

Method format_uri

S3/S3.py:293–311  ·  view source on GitHub ↗
(self, resource, base_path=None)

Source from the content-addressed store, hash-verified

291 S3Request.redir_map[bucket] = redir_hostname.lower()
292
293 def format_uri(self, resource, base_path=None):
294 bucket_name = resource.get('bucket')
295 if bucket_name and (
296 (bucket_name in S3Request.redir_map
297 and not S3Request.redir_map.get(bucket_name, '').startswith("%s."% bucket_name))
298 or (bucket_name not in S3Request.redir_map
299 and not check_bucket_name_dns_support(self.config.host_bucket, bucket_name))
300 ):
301 uri = "/%s%s" % (s3_quote(bucket_name, quote_backslashes=False,
302 unicode_output=True),
303 resource['uri'])
304 else:
305 uri = resource['uri']
306 if base_path:
307 uri = "%s%s" % (base_path, uri)
308 if self.config.proxy_host != "" and not self.config.use_https:
309 uri = "http://%s%s" % (self.get_hostname(bucket_name), uri)
310 debug('format_uri(): ' + uri)
311 return uri
312
313 ## Commands / Actions
314 def list_all_buckets(self):

Callers 3

send_requestMethod · 0.95
send_fileMethod · 0.95
recv_fileMethod · 0.95

Calls 4

get_hostnameMethod · 0.95
s3_quoteFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected