Strip off the fragment as well as any query parameters.  Fixes #2073.
Merge branch '3.0.x' of github.com:gallery/gallery3 into 3.0.x