Permalink
Browse files

Don't crash when not using any key prefix at all

  • Loading branch information...
1 parent b7ca06c commit 804d87423a74b65dc8d61475ed0f5baa29bd70d5 @f0rk f0rk committed Jun 12, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 wal_e/storage/s3_storage.py
@@ -95,8 +95,10 @@ def __init__(self, prefix, version=CURRENT_VERSION):
s3_api_prefix = url_tup.path.lstrip('/')
# Also canonicalize a trailing slash onto the prefix, should
- # none already exist.
- if s3_api_prefix[-1] != '/':
+ # none already exist. This only applies if we actually have a
+ # prefix, i.e., our objects are not being created in the bucket's
+ # root.
+ if s3_api_prefix and s3_api_prefix[-1] != '/':
self._s3_api_prefix = s3_api_prefix + '/'
else:
self._s3_api_prefix = s3_api_prefix

0 comments on commit 804d874

Please sign in to comment.