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

Fix being able to re-use request path parts in MustDo/Do #753

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Jan 6, 2025

Fix being able to re-use request path parts in MustDo/Do

Previously, this example wouldn't work:

alice := deployment.Register(t, "hs1", helpers.RegistrationOpts{})
roomID := alice.MustCreateRoom(t, map[string]interface{}{
	"preset": "public_chat",
})

requestPathParts := []string{"_matrix", "client", "v3", "directory", "list", "room", roomID}
alice.MustDo(t, "GET", requestPathParts)
// 404 because the path is already escaped and will be escaped again
alice.MustDo(t, "GET", requestPathParts)
    client.go:685: [CSAPI] GET hs1/_matrix/client/v3/directory/list/room/!DolNGvQqgiKnDmimTj:hs1 => 200 OK (3.324405ms)
    client.go:685: [CSAPI] GET hs1/_matrix/client/v3/directory/list/room/%21DolNGvQqgiKnDmimTj:hs1 => 404 Not Found (3.030919ms)

Pull Request Checklist

Signed-off-by: Eric Eastwood erice@element.io

@MadLittleMods MadLittleMods requested review from a team as code owners January 6, 2025 22:54
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Common footgun when passing by reference. Thanks for fixing!

@anoadragon453
Copy link
Member

I'm not sure why the sign-off is failing, considering it does check the raw markdown PR body, and the regex will match what you've wrote.

Merging anyways.

@anoadragon453 anoadragon453 merged commit 08ab613 into matrix-org:main Jan 7, 2025
3 of 4 checks passed
@MadLittleMods
Copy link
Contributor Author

Thanks for the review and merge @anoadragon453 🦑

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