Skip to content

Commit

Permalink
Parse source scheme with a simple str split (to bypass URL validation…
Browse files Browse the repository at this point in the history
… at this point)
  • Loading branch information
rudyryk committed Nov 9, 2023
1 parent 787f44b commit f50c71c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions coverme.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,16 @@ def _make_sources(self, config_list, environ):
environ = deepcopy(environ)
for conf in config_list:
source_type = conf.get('type')
source_url = conf['url']
scheme, _ = source_url.split('://', 1)
if source_type == 'database':
url = urlparse(conf['url'])
if url.scheme == 'postgres':
if scheme == 'postgres':
source_cls = PostgresqlBackupSource
elif url.scheme == 'mysql':
elif scheme == 'mysql':
source_cls = MySQLBackupSource
else:
raise ValueError(
"Unknown database source scheme `%s`" % url.scheme
"Unknown scheme in URL `%s`" % source_url
)
elif source_type == 'dir':
source_cls = DirBackupSource
Expand Down

0 comments on commit f50c71c

Please sign in to comment.