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

Percent Signs in Object Names causes 400 error #656

Closed
PatrickRose opened this issue Feb 10, 2016 · 4 comments
Closed

Percent Signs in Object Names causes 400 error #656

PatrickRose opened this issue Feb 10, 2016 · 4 comments

Comments

@PatrickRose
Copy link

Some files that I've been trying to upload as part of a migration to Swift have been returning 400 errors, and I couldn't work out why, until I spotted that the file names had a percent in them which doesn't look like it gets escaped. I don't think Guzzle does any urlencoding, so it looks like OpenCloud needs to do that.

I think it's sufficient to do preg_replace('/\%(?!\d{2})/', '%25', $objectName) when requesting an object. Putting []{} in my object name was handled without errors.

@PatrickRose
Copy link
Author

Of course, there's lots of places where this needs handling. Currently I've found:

  • Container::uploadObject()
  • DataObject::refresh()
  • Container::objectExists()
  • Container::uploadObject()
  • TransferPart::createRequest()

Maybe it'd be better to override the create request and catch it there?

@jamiehannaford
Copy link
Contributor

No new functionality is being added to this version of the SDK. The newer version is recommended for connecting to OpenStack clouds. I'd be happy to look into this issue if it affects the newer codebase.

If you are not in a position to migrate, a short-term fix would be to urlencode the filename yourself before uploading and after retrieving.

@PatrickRose
Copy link
Author

I've currently overridden guzzle's RequestFactory to urlencode the full path since that meant I only had to do it in one place.

@PatrickRose
Copy link
Author

It's actually explicitly mentioned in the docs that urlencoding should be done before it hits the SDK - I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants