Wrap all EventTiles with a TileErrorBoundary and guard parsePermalink (#7916)
Co-authored-by: Travis Ralston <travisr@matrix.org>
This commit is contained in:
committed by
GitHub
parent
08c47ac473
commit
16e67e7716
@@ -422,13 +422,17 @@ function getPermalinkConstructor(): PermalinkConstructor {
|
||||
}
|
||||
|
||||
export function parsePermalink(fullUrl: string): PermalinkParts {
|
||||
const elementPrefix = SdkConfig.get()['permalinkPrefix'];
|
||||
if (decodeURIComponent(fullUrl).startsWith(matrixtoBaseUrl)) {
|
||||
return new MatrixToPermalinkConstructor().parsePermalink(decodeURIComponent(fullUrl));
|
||||
} else if (fullUrl.startsWith("matrix:")) {
|
||||
return new MatrixSchemePermalinkConstructor().parsePermalink(fullUrl);
|
||||
} else if (elementPrefix && fullUrl.startsWith(elementPrefix)) {
|
||||
return new ElementPermalinkConstructor(elementPrefix).parsePermalink(fullUrl);
|
||||
try {
|
||||
const elementPrefix = SdkConfig.get()['permalinkPrefix'];
|
||||
if (decodeURIComponent(fullUrl).startsWith(matrixtoBaseUrl)) {
|
||||
return new MatrixToPermalinkConstructor().parsePermalink(decodeURIComponent(fullUrl));
|
||||
} else if (fullUrl.startsWith("matrix:")) {
|
||||
return new MatrixSchemePermalinkConstructor().parsePermalink(fullUrl);
|
||||
} else if (elementPrefix && fullUrl.startsWith(elementPrefix)) {
|
||||
return new ElementPermalinkConstructor(elementPrefix).parsePermalink(fullUrl);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("Failed to parse permalink", e);
|
||||
}
|
||||
|
||||
return null; // not a permalink we can handle
|
||||
|
||||
Reference in New Issue
Block a user