penguin/s3-arch-utils

bash scripts for s3

commit 390ff81c8efb9a2db6d3ff22092260c002cebf1b

author斟酌 鵬兄 <tgckpg@gmail.com>
date2023-09-10T15:51:16Z
subjectFixed prefix with slash generates wrong sig
commit 390ff81c8efb9a2db6d3ff22092260c002cebf1b
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2023-09-10T15:51:16Z

    Fixed prefix with slash generates wrong sig
---
 arch_delete_aws4.sh      | 2 +-
 arch_delete_many_aws4.sh | 2 +-
 arch_download_aws4.sh    | 2 +-
 arch_getacl_aws4.sh      | 2 +-
 arch_list_aws4.sh        | 2 +-
 arch_upload_aws4.sh      | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch_delete_aws4.sh b/arch_delete_aws4.sh
index 6e42aba..689eb01 100755
--- a/arch_delete_aws4.sh
+++ b/arch_delete_aws4.sh
@@ -29,7 +29,7 @@ if [ -z "$ARCH_S3_BUCKET_URL" ]; then
 fi
 
 function _str { printf "%s" $@; }
-function _stre { printf $@; }
+function _stre { printf $( echo -n "$@" | sed "s/%/%%/g" ); }
 
 BUCKET_NAME=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f1 )
 SERVICE=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f2 )
diff --git a/arch_delete_many_aws4.sh b/arch_delete_many_aws4.sh
index 328b191..8cd11c9 100755
--- a/arch_delete_many_aws4.sh
+++ b/arch_delete_many_aws4.sh
@@ -30,7 +30,7 @@ if [ -z "$ARCH_S3_BUCKET_URL" ]; then
 fi
 
 function _str { printf "%s" $@; }
-function _stre { printf $@; }
+function _stre { printf $( echo -n "$@" | sed "s/%/%%/g" ); }
 
 _TEMP=$( mktemp )
 function __clean_up { rm $_TEMP; }
diff --git a/arch_download_aws4.sh b/arch_download_aws4.sh
index 760d582..d5d75d7 100755
--- a/arch_download_aws4.sh
+++ b/arch_download_aws4.sh
@@ -28,7 +28,7 @@ if [ -z "$ARCH_S3_BUCKET_URL" ]; then
 fi
 
 function _str { printf "%s" $@; }
-function _stre { printf $@; }
+function _stre { printf $( echo -n "$@" | sed "s/%/%%/g" ); }
 
 BUCKET_NAME=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f1 )
 SERVICE=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f2 )
diff --git a/arch_getacl_aws4.sh b/arch_getacl_aws4.sh
index 50f966b..3993356 100755
--- a/arch_getacl_aws4.sh
+++ b/arch_getacl_aws4.sh
@@ -28,7 +28,7 @@ if [ -z "$ARCH_S3_BUCKET_URL" ]; then
 fi
 
 function _str { printf "%s" $@; }
-function _stre { printf $@; }
+function _stre { printf $( echo -n "$@" | sed "s/%/%%/g" ); }
 
 BUCKET_NAME=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f1 )
 SERVICE=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f2 )
diff --git a/arch_list_aws4.sh b/arch_list_aws4.sh
index 1320bf2..3169cd0 100755
--- a/arch_list_aws4.sh
+++ b/arch_list_aws4.sh
@@ -25,7 +25,7 @@ if [ -z "$ARCH_S3_BUCKET_URL" ]; then
 fi
 
 function _str { printf "%s" $@; }
-function _stre { printf $@; }
+function _stre { printf $( echo -n "$@" | sed "s/%/%%/g" ); }
 
 BUCKET_NAME=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f1 )
 SERVICE=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f2 )
diff --git a/arch_upload_aws4.sh b/arch_upload_aws4.sh
index ed6b9b5..f7acecb 100755
--- a/arch_upload_aws4.sh
+++ b/arch_upload_aws4.sh
@@ -37,7 +37,7 @@ if [ -z "$ARCH_S3_BUCKET_URL" ]; then
 fi
 
 function _str { printf "%s" $@; }
-function _stre { printf $@; }
+function _stre { printf $( echo -n "$@" | sed "s/%/%%/g" ); }
 
 BUCKET_NAME=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f1 )
 SERVICE=$( _str $ARCH_S3_BUCKET_URL | cut -d'.' -f2 )