From 666f92390ff4f96b1cdc168eb13b09e632a4ee3c Mon Sep 17 00:00:00 2001 From: Santiago Romero Date: Thu, 28 Feb 2019 11:02:58 -0500 Subject: [PATCH] Fix render when value includes the butcket name already --- s3upload/widgets.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/s3upload/widgets.py b/s3upload/widgets.py index 3ef419b0..597384a8 100644 --- a/s3upload/widgets.py +++ b/s3upload/widgets.py @@ -47,7 +47,9 @@ def get_file_url(self, value): bucket_name, ) else: - # Default to virtual-hosted–style URL + if value.startswith(bucket_name + '/'): + value = value[len(bucket_name + '/'):] + # Default to virtual-hosted-bucket URL return "https://{0}.s3.amazonaws.com/{1}".format(bucket_name, value) else: return ''