Commits

paulswartz committed 443c9b5

remove BUCKET_PREFIX, use same workaround for AWS_LOCATION

  • Participants
  • Parent commits e5fd59e

Comments (0)

Files changed (1)

File storages/backends/s3boto.py

 AUTO_CREATE_BUCKET  = getattr(settings, 'AWS_AUTO_CREATE_BUCKET', False)
 DEFAULT_ACL         = getattr(settings, 'AWS_DEFAULT_ACL', 'public-read')
 BUCKET_ACL          = getattr(settings, 'AWS_BUCKET_ACL', DEFAULT_ACL)
-BUCKET_PREFIX       = getattr(settings, 'AWS_BUCKET_PREFIX', '')
 QUERYSTRING_AUTH    = getattr(settings, 'AWS_QUERYSTRING_AUTH', True)
 QUERYSTRING_EXPIRE  = getattr(settings, 'AWS_QUERYSTRING_EXPIRE', 3600)
 REDUCED_REDUNDANCY  = getattr(settings, 'AWS_REDUCED_REDUNDANCY', False)
             "automatically created by setting AWS_AUTO_CREATE_BUCKET=True")
 
     def _clean_name(self, name):
+        if name.startswith('%s/' % self.location):
+            # if the location has gotten prefixed to the file path, remove it.
+            name = name[len(self.location)+1:]
         # Useful for windows' paths
-        if not name.startswith('%s/' % BUCKET_PREFIX):
-            prefix_string = BUCKET_PREFIX
-        else:
-            prefix_string = ''
-        return os.path.join(prefix_string, os.path.normpath(name).replace('\\', '/'))
+        return os.path.normpath(name).replace('\\', '/')
 
     def _normalize_name(self, name):
         try: