-
Notifications
You must be signed in to change notification settings - Fork 74
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
Permalinks should be able to decode and encode via servers. #300
Conversation
Previously it was skipping `&via` and just joining `via` when there were more servers. And it also just would not attempt to parse via servers when there was no event id to go with a room. turt2live#299 Signed-off-by: gnuxie <Gnuxie@protonmail.com>
turt2live/matrix-bot-sdk#300 Element takes forever reviewing anything so i suspect it'll be months before Travis even sniffs it.
turt2live/matrix-bot-sdk#300 Element takes forever reviewing anything so i suspect it'll be months before Travis even sniffs it.
test/helpers/PermalinksTest.ts
Outdated
@@ -4,27 +4,27 @@ describe('Permalinks', () => { | |||
describe('forRoom', () => { | |||
it('should generate a URL for a room ID', () => { | |||
const roomId = "!test:example.org"; | |||
const expected = `https://matrix.to/#/${roomId}`; | |||
const expected = `https://matrix.to/#/${encodeURIComponent(roomId)}`; |
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.
not encoding is deliberate for compatibility with some clients: the SDK should be able to parse encoded and unencoded URLs, but should not be producing encoded URLs.
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.
ok, that's no problem, I've changed it
Historically, clients have not produced URIs which are fully encoded. Clients should try to interpret these cases to the best of their ability. For example, an unencoded room alias should still work within the client if possible.
The components of the matrix.to URI ( and ) are to be percent-encoded as per RFC 3986
Though the spec does imply the bad links should no longer be generated when it probably should not.
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.
I guess I need to actually hit the approve button, hey
Thanks! |
Previously it was skipping
&via
and just joiningvia
when there were more servers. And it also just would not attempt to parse via servers when there was no event id to go with a room.Closes #299
Checklist