Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: bladealslayer/s3cmd
...
head fork: bladealslayer/s3cmd
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 17, 2012
@bladealslayer Added option to preserve public access for objects when doing remote …
…to remote copy/sync.

New options is --acl-copy-public and has effect for anything that calls underlying S3.object_copy.
9b645c0
@bladealslayer Merge branch 'feature/acl-public-copy' 6ac0e57
Showing with 9 additions and 0 deletions.
  1. +1 −0  S3/Config.py
  2. +7 −0 S3/S3.py
  3. +1 −0  s3cmd
View
1  S3/Config.py
@@ -34,6 +34,7 @@ class Config(object):
skip_existing = False
recursive = False
acl_public = None
+ acl_copy_public = False
acl_grants = []
acl_revokes = []
proxy_host = ""
View
7 S3/S3.py
@@ -418,6 +418,13 @@ def object_copy(self, src_uri, dst_uri, extra_headers = None):
headers["x-amz-storage-class"] = "REDUCED_REDUNDANCY"
if extra_headers:
headers.update(extra_headers)
+
+ # Sync public ACL
+ if self.config.acl_copy_public:
+ acl = self.get_acl(src_uri)
+ if acl.isAnonRead():
+ headers["x-amz-acl"] = "public-read"
+
request = self.create_request("OBJECT_PUT", uri = dst_uri, headers = headers)
try:
response = self.send_request(request)
View
1  s3cmd
@@ -1499,6 +1499,7 @@ def main():
optparser.add_option( "--check-md5", dest="check_md5", action="store_true", help="Check MD5 sums when comparing files for [sync]. (default)")
optparser.add_option( "--no-check-md5", dest="check_md5", action="store_false", help="Do not check MD5 sums when comparing files for [sync]. Only size will be compared. May significantly speed up transfer but may also miss some changed files.")
optparser.add_option("-P", "--acl-public", dest="acl_public", action="store_true", help="Store objects with ACL allowing read for anyone.")
+ optparser.add_option( "--acl-copy-public", dest="acl_copy_public", action="store_true", help="When copying or syncing remote objects, preserve public ACLs.")
optparser.add_option( "--acl-private", dest="acl_public", action="store_false", help="Store objects with default ACL allowing access for you only.")
optparser.add_option( "--acl-grant", dest="acl_grants", type="s3acl", action="append", metavar="PERMISSION:EMAIL or USER_CANONICAL_ID", help="Grant stated permission to a given amazon user. Permission is one of: read, write, read_acp, write_acp, full_control, all")
optparser.add_option( "--acl-revoke", dest="acl_revokes", type="s3acl", action="append", metavar="PERMISSION:USER_CANONICAL_ID", help="Revoke stated permission for a given amazon user. Permission is one of: read, write, read_acp, wr ite_acp, full_control, all")

No commit comments for this range

Something went wrong with that request. Please try again.