aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/source.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/cogs/source.py b/bot/cogs/source.py
index d59371c6e..2ca852af3 100644
--- a/bot/cogs/source.py
+++ b/bot/cogs/source.py
@@ -82,7 +82,12 @@ class BotSource(commands.Cog):
first_line_no = None
lines_extension = ""
- file_location = Path(filename).relative_to("/bot/")
+ # Handle tag file location differently than others to avoid errors in some cases
+ if not first_line_no:
+ file_location = Path(filename).relative_to("/bot/")
+ else:
+ file_location = Path(filename).relative_to(Path.cwd()).as_posix()
+
url = f"{URLs.github_bot_repo}/blob/master/{file_location}{lines_extension}"
return url, file_location, first_line_no or None