[SourcesManager] Fix the handling of invalid URLs