我有一个带有特殊字符的s3对象\x{1B} (A的前面)
aws --profile myprofile s3api delete-object --bucket test-bucket --key `ABCD` --version 1234当我尝试使用cli删除它时,由于特殊字符,它不尊重它。
如果我尝试通过以下方式使用boto3和python
bucket.object_versions.delete()我得到了
botocore.exceptions.ClientError: An error occurred (MalformedXML) when calling the DeleteObjects operation: The XML you provided was not well-formed or did not validate against our published schema如果我尝试从UI中删除,操作将成功,但对象不会消失。
我希望永久删除该对象。感谢您的指点。
发布于 2021-01-15 01:43:21
不要使用反引号‘使用单引号’。
在Linux/Unix shell中,使用反引号是为了运行内联命令。
通过提供该特殊字符的十六进制代码,可以使用printf打印任何内容。例如,要将制表符添加到键中,请使用:
--key `printf 'a\x09b'`这一次,需要使用反引号。
https://stackoverflow.com/questions/65724021
复制相似问题