mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
Safely grab the OpenGraph title out of the URL preview for link safety (#9028)
This commit is contained in:
parent
0bc2f1c101
commit
62f3a9ae05
1 changed files with 3 additions and 2 deletions
|
@ -120,8 +120,9 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
|
|||
// opaque string. This does not allow any HTML to be injected into the DOM.
|
||||
const description = AllHtmlEntities.decode(p["og:description"] || "");
|
||||
|
||||
const anchor = <a href={this.props.link} target="_blank" rel="noreferrer noopener">{ p["og:title"] }</a>;
|
||||
const needsTooltip = PlatformPeg.get()?.needsUrlTooltips() && this.props.link !== p["og:title"].trim();
|
||||
const title = p["og:title"]?.trim() ?? "";
|
||||
const anchor = <a href={this.props.link} target="_blank" rel="noreferrer noopener">{ title }</a>;
|
||||
const needsTooltip = PlatformPeg.get()?.needsUrlTooltips() && this.props.link !== title;
|
||||
|
||||
return (
|
||||
<div className="mx_LinkPreviewWidget">
|
||||
|
|
Loading…
Reference in a new issue