thephpleague / flysystem-rackspace

Flysystem Adapter for Rackspace
37 stars 28 forks source link

URL Encode filenames #12

Closed PatrickRose closed 8 years ago

PatrickRose commented 8 years ago

It's mentioned briefly in the docs for OpenCloud that file names should be URL encoded if they're non-standard. Should the Rackspace adapter be handling this, or should I ensure my filenames are URLEncoded before passing them down the chain?

frankdejonge commented 8 years ago

@PatrickRose this should probably be handled within the adapter.

frankdejonge commented 8 years ago

@PatrickRose which kind of url encoding do they require here? urlencode or rawurlencode? Do you have the link to the docs?

PatrickRose commented 8 years ago

I'm using rawurlencode (though I can't remember why offhand) Docs have a notice here

frankdejonge commented 8 years ago

@PatrickRose the docs say we should be using urlencode, I'll use that for all the segments, commit incoming.

PatrickRose commented 8 years ago

Ahh, I remember why. Guzzle under the hood replaces ' ' with '%20'. We spotted this after we'd been using it for a while so we needed to keep the filenames the same. Would it be possible to use rawurlencode?

frankdejonge commented 8 years ago

@PatrickRose does it matter that it does it? because urlencode replaces it with + so Guzzle can't replace it anymore.

PatrickRose commented 8 years ago

It's a definite BC break, because previously $filesystem->exists('some file') would return true, and with urlencode it wouldn't.

frankdejonge commented 8 years ago

ah, so it actually SHOULD be rawurlencode.

frankdejonge commented 8 years ago

Corrected that.

PatrickRose commented 8 years ago

I think there's a minor BC break as part of this, so not sure how you want to handle it (I believe it's cases like $filesystem->put('some#file') actually wrote to 'some')

frankdejonge commented 8 years ago

@PatrickRose ~_^

PatrickRose commented 8 years ago

Sorry <3

I think it's okay - it's rare that people have those in their file names, which was something I had to deal with because users.

frankdejonge commented 8 years ago

:neckbeard: