Skip to content


$.mobile.path.get() not cleaning URL correctly #4633

ucavus opened this Issue · 1 comment

1 participant


In $.mobile.path.get():

return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, '' )

should be

return path.stripHash( newPath ).replace( /[?#].*/, '' ).replace( /[^\/]+$/, '' );

The former seems to assume there will always be a filename with a . after the last / in the path and that no one will put / in a query string. I'm not sure of the significance of looking for literal * characters, either.

The latter first makes sure we only have a path at the end, then removes anything that is not a directory.

This was the cause of issue #4275 for me.


Based on the docs, despite saying it's for "determining the directory portion of an URL", it's really determining something custom because there's no way a URL of only ?a=1&b=2 is a directory. So I won't bother trying to make sense of it.

@ucavus ucavus closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.