Skip to content

Fix initial path double slash in forgejo urls#205

Merged
piegamesde merged 2 commits intoandir:masterfrom
Coca162:double-slash
Feb 27, 2026
Merged

Fix initial path double slash in forgejo urls#205
piegamesde merged 2 commits intoandir:masterfrom
Coca162:double-slash

Conversation

@Coca162
Copy link
Collaborator

@Coca162 Coca162 commented Feb 15, 2026

Pointed out in #204

} => format!("{}/{}/{}.git", server, owner, repo).parse()?,
} => {
let mut server = server.clone();
server.set_path(&format!("{owner}/{repo}.git"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While that does fix it, so far the code has instead normalized the strings within npins w.r.t. slashes etc., see e.g. line 277. I'd suggest sticking on one of the two, and then making our invariants more explicit maybe to prevent regressions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not puzzling together how that is applicable here, since this is mutating a existing Url and so deals so with a presumably already normalized input?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT the Url type is not normalized and merely a checked wrapper around some raw string backing with structured accessors, so all normalization would be up to npins to do upon url creation/storing. We mostly do this already, but not in all cases, so the suggestion would be to go all-in on that.

Copy link
Collaborator Author

@Coca162 Coca162 Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it turns out special urls always have a / path and can not be empty, so the url.set_path(""); in strip_url is actually a / path in all our use cases.

@piegamesde piegamesde merged commit 2449cd0 into andir:master Feb 27, 2026
1 check passed
@Coca162 Coca162 deleted the double-slash branch February 27, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants