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

Flyway incorrectly handles paths with a + in their name #884

Closed
stevetodd opened this issue Nov 18, 2014 · 1 comment
Closed

Flyway incorrectly handles paths with a + in their name #884

stevetodd opened this issue Nov 18, 2014 · 1 comment

Comments

@stevetodd
Copy link

@stevetodd stevetodd commented Nov 18, 2014

UrlUtils takes the URL given to it and applies URLDecode.decode() to the file path. This shouldn't be done. According to the javadocs:

Utility class for HTML form decoding. This class contains static methods for decoding a String from the application/x-www-form-urlencoded MIME format.

The decoder should only applied to parameters included in the form. The problem manifests itself when a path passed to this method includes a '+'. For example, /foo/bar+baz/biz. When the path gets sent to this method, it replaces the '+' with a ' ' (space). The path becomes /foo/bar baz/biz.

My case is that I have my project on a path with a plus in it. When I try to run flyway, it doesn't find the migrations because the URL gets decoded incorrectly.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Nov 24, 2014

Good catch, but it's actually not that easy...

Example: A file /my dir/a+b/file.txt will get a url path like /my%20dir/a+b/file.txt which will be decoded to /my dir/a b/file.txt

This leaves us with:
Decoded: space (+other encoded chars) ok, plus wrong
Undecoded: space (+other encoded chars) wrong, plus ok

This is almost certainly a JDK bug in the file.toURI().toURL() chain, that will need to be worked around.

Cheers
Axel

@axelfontaine axelfontaine changed the title UrlUtils incorrectly applies URLDecoder.decode() Flyway incorrectly handles paths with a + in their name Nov 24, 2014
@axelfontaine axelfontaine added this to the Flyway 3.1 milestone Nov 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants