gitea: Extra slash in URL makes git clone fail
Description
Cloning a repository with a double slash fails:
$ git clone https://git.data.coop//halfd/new-website.git
Cloning into 'new-website'...
remote: Not found.
fatal: repository 'https://git.data.coop//halfd/new-website.git/' not found
Gitea Version
1.16.8
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Using the docker image.
Database
SQLite
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (9 by maintainers)
Commits related to this issue
- Support sanitising the URL by removing extra slashes in the URL (#21333) Changes in this PR : Strips incoming request URL of additional slashes (/). For example an input like `https://git.data... — committed to GiteaBot/gitea by sandyydk a year ago
- Support sanitising the URL by removing extra slashes in the URL (#21333) (#23300) Backport #21333 Changes in this PR : Strips incoming request URL of additional slashes (/). For example an inp... — committed to go-gitea/gitea by GiteaBot a year ago
FYI, Github & Gitlab allows any arbitrary number of extra leading slashes, even better, it allows any number of slashes, for every valid slash position. Well I still consider this user fault, I personally won’t put up a PR for this. But feel free to use this patch and create a PR for this:
This is just to strip leading/trailing slashes and still have working behavior:
However if someone wants to go ahead and argue that also considering every other slash position to allow for multiple slashes, feel free to use this patch and create a PR:
OK, as a bystander, I think there are some misunderstanding or miscommunication during this issue’s history.
First, thank you all for making Gitea better.
The current situation is:
In my mind:
https://github.com/go-gitea/gitea////////////tree/main/////.github