fix typo breaking downloading files specified as URLs (used in WIEN2k, WPS)

fix bug introduced in #902, and enhance unit tests so it never occurs again