Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Handle all the segments of a v3 event ID
Browse files Browse the repository at this point in the history
They may contain slashes, so it is not suitable to just pull the first segment after the room ID. Instead, we just recompile the event ID from known source, assuming everything afterwards is an event ID.

Fixes element-hq/element-web#8315

This will need adapting to support element-hq/element-web#9149
  • Loading branch information
turt2live committed Mar 26, 2019
1 parent a3a242f commit d8edf2e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,16 @@ export default React.createClass({
} else if (screen.indexOf('room/') == 0) {
const segments = screen.substring(5).split('/');
const roomString = segments[0];
const eventId = segments[1]; // undefined if no event id given
let eventId = segments.splice(1).join("/"); // empty string if no event id given

// Previously we pulled the eventID from the segments in such a way
// where if there was no eventId then we'd get undefined. However, we
// now do a splice and join to handle v3 event IDs which results in
// an empty string. To maintain our potential contract with the rest
// of the app, we coerce the eventId to be undefined where applicable.
if (!eventId) eventId = undefined;

// TODO: Handle encoded room/event IDs: https://github.com/vector-im/riot-web/issues/9149

// FIXME: sort_out caseConsistency
const thirdPartyInvite = {
Expand Down

0 comments on commit d8edf2e

Please sign in to comment.