When downloading files we currently save using the original extension, but these extensions can often be wrong, either lacking or ending in .php. We can fix this by checking if the extension is valid and added add a valid one or correct the existing in the preferredFilename.
Created attachment 175647 [details] Patch
Is there a http test for this, btw? Strong feeling there might :)
Committed r135511: <http://trac.webkit.org/changeset/135511>