Fix issues with Uri.

Filenames shall not be percent-encoded, and we don't want to ignore what
is after a '?'.