Clean up underscore handling in image titles
For the file endpoint, always redirect from the URL with spaces to the
one with underscores, but then load the file data using the title with
spaces (which is what the API wants). This also has the consequence that
the template always sees the space version, i. e. displays that and not
the underscore version as the heading.
Also add a test for the redirect behavior (first test for this tool!).