mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Downloader] Make Repo.clean_url work with relative urls. (#3142)
* fix(downloader): return string, catch ValueError for relative urls * chore(changelog): add towncrier entry
This commit is contained in:
parent
ddfabb0c0e
commit
4b62598a3d
1
changelog.d/downloader/3141.bugfix.rst
Normal file
1
changelog.d/downloader/3141.bugfix.rst
Normal file
@ -0,0 +1 @@
|
||||
Make :attr:`redbot.cogs.downloader.repo_manager.Repo.clean_url` work with relative urls. This property uses `str` type now.
|
||||
@ -149,11 +149,13 @@ class Repo(RepoJSONMixin):
|
||||
self._loop = loop if loop is not None else asyncio.get_event_loop()
|
||||
|
||||
@property
|
||||
def clean_url(self):
|
||||
def clean_url(self) -> str:
|
||||
"""Sanitized repo URL (with removed HTTP Basic Auth)"""
|
||||
url = yarl.URL(self.url)
|
||||
clean_url = url.with_user(None)
|
||||
return clean_url
|
||||
try:
|
||||
return url.with_user(None).human_repr()
|
||||
except ValueError:
|
||||
return self.url
|
||||
|
||||
@classmethod
|
||||
async def convert(cls, ctx: commands.Context, argument: str) -> Repo:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user