Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle empty return bodies when processing S3 errors.

Currently error commands that do not return a body cause
s3cmd to output an ugly backtrace. This change checks to
see if the data field of the response is non-empty before
calling `getTreeFromXml` on it. An example of an offending
command is using `s3cmd info` on a nonexistent object.
  • Loading branch information...
commit a845140fd7f3dc0301299faa376e1fb750f7ec4e 1 parent 23d133a
Kelly McLaughlin kellymclaughlin authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  S3/Exceptions.py
2  S3/Exceptions.py
View
@@ -44,7 +44,7 @@ def __init__(self, response):
if response.has_key("headers"):
for header in response["headers"]:
debug("HttpHeader: %s: %s" % (header, response["headers"][header]))
- if response.has_key("data"):
+ if response.has_key("data") and response["data"]:
tree = getTreeFromXml(response["data"])
error_node = tree
if not error_node.tag == "Error":
Please sign in to comment.
Something went wrong with that request. Please try again.