[SourcesManager] More robust generation of source names from URLs
[SourcesManager] Fix the handling of invalid URLs