Avoid illegal URI characters in data source path.

Fixes bug spotted by @tomayac.