Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.63k stars 2.28k forks source link

Inconsistent behavior between [p]repo add and other commands #6371

Open Flame442 opened 2 months ago

Flame442 commented 2 months ago

What Red version are you using?

3.5.9

Cog name

Downloader

Command name

repo

What happened?

When running [p]repo add, if the name used is the same as an already installed repo but with different casing, the bot says a repo with that name already exists. When running [p]repo del, the correct casing must be used, or the bot will say a repo with that name does not exist. It is confusing that a repo can be stated to exist with one command, but not exist with another. Similar case-sensitive parsing happens with [p]cog install, and likely other commands.

How can we reproduce this error?

  1. [p]repo add test https://github.com/Flame442/FlameCogs
  2. [p]repo add TEST https://github.com/Flame442/FlameCogs -> already exists
  3. [p]repo del TEST https://github.com/Flame442/FlameCogs -> does not exist

Anything else?

Downloader stores repos in folders that should be interpreted case insensitively. The Repo converter should be updated to be able to match an existing repo regardless of the specific casing used.

[p]repo add eventually reaches this function, which checks if the path exists case insensitively, rather than just if the repo exists in ._repos. https://github.com/Cog-Creators/Red-DiscordBot/blob/975c0007fe3da1f0607799c3672a2f57c32a6e8e/redbot/cogs/downloader/repo_manager.py#L187-L189

Zephyrkul commented 2 months ago

Are you running on Windows? [p]repo add with different cases works fine on my Linux install - maybe you're running into a case of Windows utilizing a case-insensitive filesystem?

Flame442 commented 2 months ago

It may be a windows specific issue due to differences in how paths are resolved, but the UX in that case should probably still be improved.