cldf / cldfcatalog

Python library to access reference catalogs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sanitize repo URLs to avoid adding access tokens to CLDF data

xrotwang opened this issue · comments

Here

def url(self):
"""
:return: The URL of the remote called `origin` - if it is set, else `None`.
Note: Since computing the remote may require a `git` call, and we assume the origin will
not change, we cache the result.
"""
if self._url is None:
try:
url = self.repo.remotes.origin.url
if url.endswith('.git'):
url = url[:-4]
self._url = url
except AttributeError: # pragma: no cover
pass
return self._url

we should remove any auth credentials to avoid adding sensitive info to CLDF data, e.g. when a repos has been cloned with a URL including auth info.