Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capitalization discarded on push-to-create #29073

Closed
RGBCube opened this issue Feb 7, 2024 · 9 comments · Fixed by #29090
Closed

Capitalization discarded on push-to-create #29073

RGBCube opened this issue Feb 7, 2024 · 9 comments · Fixed by #29090
Labels
Milestone

Comments

@RGBCube
Copy link

RGBCube commented Feb 7, 2024

Description

I have enabled repository.ENABLE_PUSH_CREATE_USER and created a repo after pushing, my remotes are:

Test on  master took 2s
❯ git remote --verbose

origin  ssh://forgejo@rgbcu.be:2222/RGBCube/TestTwo (fetch)
origin  ssh://forgejo@rgbcu.be:2222/RGBCube/TestTwo (push)

But the repo created on my instance is named testtwo. Somewhere Gitea is lowercasing the repo name for case insensitiveness which is nice, but I'd like it to be preserved when push-to-create-ing for the first time.

Gitea Version

1.21.5

Can you reproduce the bug on the Gitea demo site?

Yes

Screenshots

image

How are you running Gitea?

NixOS module, irrelevant.

Database

PostgreSQL

@yardenshoham
Copy link
Member

I tried reproducing but it looks ok to me.
image
image

@jolheiser
Copy link
Member

My guess is it's specific to SSH:

gitea/cmd/serv.go

Lines 219 to 228 in 5c0fc90

// LowerCase and trim the repoPath as that's how they are stored.
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
rr := strings.SplitN(repoPath, "/", 2)
if len(rr) != 2 {
return fail(ctx, "Invalid repository path", "Invalid repository path: %v", repoPath)
}
username := strings.ToLower(rr[0])
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))

@RGBCube
Copy link
Author

RGBCube commented Feb 7, 2024

My guess is it's specific to SSH:

gitea/cmd/serv.go

Lines 219 to 228 in 5c0fc90

// LowerCase and trim the repoPath as that's how they are stored.
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
rr := strings.SplitN(repoPath, "/", 2)
if len(rr) != 2 {
return fail(ctx, "Invalid repository path", "Invalid repository path: %v", repoPath)
}
username := strings.ToLower(rr[0])
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))

Yup, I use SSH authentication for this

@techknowlogick
Copy link
Member

@RGBCube is it the opensshd ssh implementation or the built-in to the binary ssh server you are using? The issue would likely apply to both, but just in case it doesn't this will help debug/fix. Thanks for the report :)

@lunny
Copy link
Member

lunny commented Feb 8, 2024

Line 227 and line 228, they should not be lowercase.

@lunny
Copy link
Member

lunny commented Feb 8, 2024

I tried reproducing but it looks ok to me. image image

You are using http protocol. User can try SSH protocol.

@lunny lunny added this to the 1.21.6 milestone Feb 8, 2024
@RGBCube
Copy link
Author

RGBCube commented Feb 8, 2024

@RGBCube is it the opensshd ssh implementation or the built-in to the binary ssh server you are using? The issue would likely apply to both, but just in case it doesn't this will help debug/fix. Thanks for the report :)

I'm using sshd at the moment (don't have the BUILTIN_SSH_SERVER option enabled)

@lunny
Copy link
Member

lunny commented Feb 8, 2024

The code affected both opensshd and builtin ssh server.

lunny added a commit to lunny/gitea that referenced this issue Feb 17, 2024
KN4CK3R added a commit that referenced this issue Feb 17, 2024
Fix #29073
Backport #29090

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
6543 pushed a commit to 6543-forks/gitea that referenced this issue Feb 26, 2024
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants