fix: ensure HTML tags are stripped from OpenGraph description

Fixes https://github.com/shaarli/Shaarli/issues/1250
Relates to https://github.com/shaarli/Shaarli/issues/1242

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
VirtualTam 2019-01-18 22:58:09 +01:00
parent 43c77f658a
commit 2c16e8e9a8
2 changed files with 2 additions and 2 deletions

View file

@ -21,7 +21,7 @@
<meta property="og:type" content="article" /> <meta property="og:type" content="article" />
<meta property="og:url" content="{$index_url}?{$link.shorturl}" /> <meta property="og:url" content="{$index_url}?{$link.shorturl}" />
{$ogDescription=isset($link.description_src) ? $link.description_src : $link.description} {$ogDescription=isset($link.description_src) ? $link.description_src : $link.description}
<meta property="og:description" content="{function="substr($ogDescription, 0, 300)"}" /> <meta property="og:description" content="{function="substr(strip_tags($ogDescription), 0, 300)"}" />
{if="$link.thumbnail"} {if="$link.thumbnail"}
<meta property="og:image" content="{$index_url}{$link.thumbnail}" /> <meta property="og:image" content="{$index_url}{$link.thumbnail}" />
{/if} {/if}

View file

@ -18,7 +18,7 @@
<meta property="og:type" content="article" /> <meta property="og:type" content="article" />
<meta property="og:url" content="{$index_url}?{$link.shorturl}" /> <meta property="og:url" content="{$index_url}?{$link.shorturl}" />
{$ogDescription=isset($link.description_src) ? $link.description_src : $link.description} {$ogDescription=isset($link.description_src) ? $link.description_src : $link.description}
<meta property="og:description" content="{function="mb_substr($ogDescription, 0, 300)"}" /> <meta property="og:description" content="{function="mb_substr(strip_tags($ogDescription), 0, 300)"}" />
{if="$link.thumbnail"} {if="$link.thumbnail"}
<meta property="og:image" content="{$index_url}{$link.thumbnail}" /> <meta property="og:image" content="{$index_url}{$link.thumbnail}" />
{/if} {/if}