Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left angle bracket in file name => MalformedXML #1014

Closed
rips-hb opened this issue Jun 8, 2016 · 3 comments
Closed

Left angle bracket in file name => MalformedXML #1014

rips-hb opened this issue Jun 8, 2016 · 3 comments
Labels
guidance Question that needs advice or information.

Comments

@rips-hb
Copy link

rips-hb commented Jun 8, 2016

Hi there,

when I am trying to delete something with

$s3->deleteMatchingObjects(AWS_S3_BUCKET, (int)$id . '/');

and there is a file in there with a < in the name I get the following error:

Aws\S3\Exception\S3Exception: Error executing "DeleteObjects" on "https://s3.xxx.amazonaws.com/xxx?delete"; AWS HTTP error: Client error: `POST https://s3.xxx.amazonaws.com/xxx?delete` resulted in a `400 Bad Request` response: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>MalformedXML</Code><Message>The XML you provided was not well-formed (truncated...) MalformedXML (client): The XML you provided was not well-formed or did not validate against our published schema - <?xml version="1.0" encoding="UTF-8"?> <Error><Code>MalformedXML</Code><Message>The XML you provided was not well-formed or did not validate against our published schema</Message><RequestId>xxx</RequestId><HostId>xxx</HostId></Error>

#0 /var/AWS/Aws/WrappedHttpHandler.php(102): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\Command), Array)
#1 /var/AWS/GuzzleHttp/Promise/Promise.php(201): Aws\WrappedHttpHandler->Aws\{closure}(Array)
#2 /var/AWS/GuzzleHttp/Promise/Promise.php(172): GuzzleHttp\Promise\Promise::callHandler(2, Array, Array)
#3 /var/AWS/GuzzleHttp/Promise/RejectedPromise.php(40): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}(Array)
#4 /var/AWS/GuzzleHttp/Promise/TaskQueue.php(61): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise\{closure}()
#5 /var/AWS/GuzzleHttp/Promise/Promise.php(242): GuzzleHttp\Promise\TaskQueue->run(true)
#6 /var/AWS/GuzzleHttp/Promise/Promise.php(219): GuzzleHttp\Promise\Promise->invokeWaitFn()
#7 /var/AWS/GuzzleHttp/Promise/Promise.php(262): GuzzleHttp\Promise\Promise->waitIfPending()
#8 /var/AWS/GuzzleHttp/Promise/Promise.php(221): GuzzleHttp\Promise\Promise->invokeWaitList()
#9 /var/AWS/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#10 /var/AWS/Aws/S3/S3ClientTrait.php(88): GuzzleHttp\Promise\Promise->wait()

I am running version 3.18.16, but it also did not work in older versions. Any idea what could cause this or better: how to fix this?

Thanks!

@cjyclaire cjyclaire added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Jun 8, 2016
@cjyclaire
Copy link
Contributor

cjyclaire commented Jun 8, 2016

@rips-hb, Since xml that doesn't conform to the published xsd schema and fails the validation, I'd suggest some work around. This is caused by improperly encoded path, since the file name contains special characters, could you try '/' . rawurlencode(SPECIAL_FILE_KEY) for those files?

@cjyclaire cjyclaire added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 8, 2016
@rips-hb
Copy link
Author

rips-hb commented Jun 9, 2016

Thanks for the answer. I already do replace the character when writing the files as a workaround, it just feels a bit hackish to me. If I forget to do it somewhere in the future I will end up with a undeletable directory.

@cjyclaire cjyclaire removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 9, 2016
@cjyclaire
Copy link
Contributor

@rips-hb ,Since an XML parsing exception due to unescaped XML characters in the XML response is a server side issue that cannot be fixed by the SDK, so it would be great if you could let the Amazon S3 team know that this is important to you by posting to their forum. Great thanks for your feedback!

I'll going to close this issue, yet feel free to reopen if you have further questions :)

@cjyclaire cjyclaire added the guidance Question that needs advice or information. label Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants