From 7958638e8f7800813fe8ec5bb860c14e3b81c6c0 Mon Sep 17 00:00:00 2001 From: Ellen Leahy Date: Thu, 21 Jul 2016 11:27:59 +0100 Subject: [PATCH] Added quotes to example echo in swift-temp-url If the curl command is used exactly as in the help, the ampersand in the signature is interpreted as an operator and the curl command breaks. I am aware of developers who have wasted a lot of time because of this. Change-Id: I6468c9a098b56db8242a2cf2c23b7a4857bd8574 --- bin/swift-temp-url | 8 ++++---- doc/source/api/temporary_url_middleware.rst | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/swift-temp-url b/bin/swift-temp-url index 34445e8be8..09b042fede 100755 --- a/bin/swift-temp-url +++ b/bin/swift-temp-url @@ -40,13 +40,13 @@ if __name__ == '__main__': print() print('This can be used to form a URL to give out for the access ') print('allowed. For example:') - print(' echo https://swift-cluster.example.com`%s GET 60 ' - '/v1/AUTH_account/c/o mykey`' % prog) + print(' echo \\"https://swift-cluster.example.com`%s GET 60 ' + '/v1/AUTH_account/c/o mykey`\\"' % prog) print() print('Might output:') - print(' https://swift-cluster.example.com/v1/AUTH_account/c/o?' + print(' "https://swift-cluster.example.com/v1/AUTH_account/c/o?' 'temp_url_sig=34d49efc32fe6e3082e411eeeb85bd8a&' - 'temp_url_expires=1323482948') + 'temp_url_expires=1323482948"') exit(1) method, seconds, path, key = argv[1:5] try: diff --git a/doc/source/api/temporary_url_middleware.rst b/doc/source/api/temporary_url_middleware.rst index 093bd528ec..1debf7d542 100644 --- a/doc/source/api/temporary_url_middleware.rst +++ b/doc/source/api/temporary_url_middleware.rst @@ -178,3 +178,8 @@ storage host name. For example, prefix the path with https://swift-cluster.example.com/v1/my_account/container/object ?temp_url_sig=5c4cc8886f36a9d0919d708ade98bf0cc71c9e91 &temp_url_expires=1374497657 + +Note that if the above example is copied exactly, and used in a command +shell, then the ampersand is interpreted as an operator and the URL +will be truncated. Enclose the URL in quotation marks to avoid this. +