diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index 2b50b387c7..fa21fb973b 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -780,9 +780,9 @@ ve.ui.MWMediaDialog.prototype.cleanAPIresponse = function ( rawResponse, config } // Check if the string should be truncated - return isTruncated && !config.ignoreCharLimit ? - originalText.substring( 0, charLimit ) + ellipsis : - originalText; + return mw.html.escape( isTruncated && !config.ignoreCharLimit ? + originalText.slice( 0, charLimit ) + ellipsis : + originalText ); }; /**