aboutsummaryrefslogtreecommitdiff
path: root/license_protected_downloads/artifact/s3.py
diff options
context:
space:
mode:
authorBen Copeland <ben.copeland@linaro.org>2016-03-02 10:42:08 +0000
committerBen Copeland <ben.copeland@linaro.org>2016-03-03 16:18:05 +0000
commit93511e46258a40b6d84fb3118cafba835767f51c (patch)
tree38e05bf16ac0491ba9d77219ca6c8d5307a72d5c /license_protected_downloads/artifact/s3.py
parentb2015d5bf382316adfb7e898de04d3e93500285d (diff)
S3: Patch to fix headers.html
We have a headers.html file, which shows general server text. This patch allows for the header.html to be read from S3 Change-Id: I62b6709be78cbfbbaee9bbc70fe9b79583491b26 Reviewed-on: https://review.linaro.org/10781 Reviewed-by: Andy Doan <andy.doan+gerrit@linaro.org>
Diffstat (limited to 'license_protected_downloads/artifact/s3.py')
-rw-r--r--license_protected_downloads/artifact/s3.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/license_protected_downloads/artifact/s3.py b/license_protected_downloads/artifact/s3.py
index c5fc109..ef1d57c 100644
--- a/license_protected_downloads/artifact/s3.py
+++ b/license_protected_downloads/artifact/s3.py
@@ -29,8 +29,9 @@ class S3Artifact(Artifact):
return cls.bucket
def __init__(self, bucket, item, parent, human_readable):
- base = '/' + os.path.dirname(item.name)
- base = base.replace(settings.S3_PREFIX_PATH, '')
+ base = item.name.replace(settings.S3_PREFIX_PATH, '')
+ if base:
+ base = '/' + os.path.dirname(base)
if hasattr(item, 'size'):
file_name = os.path.basename(item.name)
@@ -42,8 +43,11 @@ class S3Artifact(Artifact):
else:
self.mtype = 'folder'
self.children = []
- base = os.path.dirname(base)
- file_name = os.path.basename(item.name[:-1])
+ if base:
+ base = os.path.dirname(base)
+ file_name = os.path.basename(item.name[:-1])
+ else:
+ file_name = ''
item.size = 0
item.last_modified = '-'
self.bucket = bucket