-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix joined urls #26774
Fix joined urls #26774
Conversation
{ // https://github.com/go-gitea/gitea/issues/25632 | ||
Base: "/owner/repo/media/branch/main", | ||
Elems: []string{"/../other/image.png"}, | ||
Expected: "/owner/repo/media/branch/other/image.png", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old code: "/other/image.png"
New code: "/owner/repo/media/branch/other/image.png"
newTest("https://try.gitea.io/a/b/c", | ||
"https://try.gitea.io", "a/b", "c"), | ||
newTest("https://try.gitea.io/a/b/c", | ||
"https://try.gitea.io/", "/a/b/", "/c/"), | ||
newTest("https://try.gitea.io/a/c", | ||
"https://try.gitea.io/", "/a/./b/", "../c/"), | ||
newTest("a/b/c", | ||
"a", "b/c/"), | ||
newTest("a/b/d", | ||
"a/", "b/c/", "/../d/"), | ||
newTest("https://try.gitea.io/a/b/c#d", | ||
"https://try.gitea.io", "a/b", "c#d"), | ||
newTest("/a/b/d", | ||
"/a/", "b/c/", "/../d/"), | ||
newTest("/a/b/c", | ||
"/a", "b/c/"), | ||
newTest("/a/b/c#hash", | ||
"/a", "b/c#hash"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted these test cases into a (for me) more readable format.
Overall LGTM (although CI failures seem related) |
Fixed with e823e33 Our |
if strings.Contains(elems[last], "#") { | ||
elems[last], fragment, _ = strings.Cut(elems[last], "#") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
banch name can also have # like BranchName#123
"/a/b/c#hash", "/a#123", "b/c#1212"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, works for me then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why this PR is marked as depending on the other PR. If #26745 is merged, the test will work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohk, got it. my bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
CI still failed. |
Fixes #25632
Depends on #26745