Incorrect insertion of the UTF8 charset in the HTML filter (#782)
This commit is contained in:
parent
8a068a3941
commit
c91d85d53a
|
@ -118,7 +118,7 @@ manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
|||
str += decoder.decode(); // end-of-stream
|
||||
|
||||
// set UTF-8 in document
|
||||
str = str.replace(new RegExp(`charset=["']?${charset}["']?`), 'charset="utf8"');
|
||||
str = manipulateDOM._searchCharset(str, charset);
|
||||
|
||||
// remove crossorigin and integrity attributes
|
||||
str = str.replace(/<(link|script)[^>]+>/ig, (m) => {
|
||||
|
@ -138,6 +138,17 @@ manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
|||
}
|
||||
};
|
||||
|
||||
manipulateDOM._searchCharset = function (str, charset) {
|
||||
if (str.indexOf(`charset="${charset}"`) > 0) {
|
||||
return str.replace(`charset="${charset}"`, 'charset="utf8"');
|
||||
} else if (str.indexOf(`charset='${charset}'`) > 0) {
|
||||
return str.replace(`charset='${charset}'`, 'charset=\'utf8\'');
|
||||
} else if (str.indexOf(`charset=${charset}`) > 0) {
|
||||
return str.replace(`charset=${charset}`, 'charset=utf8');
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializations
|
||||
|
|
|
@ -60,6 +60,10 @@
|
|||
<li>i18n: Vietnamese</li>
|
||||
<li>ember.js v4.0.0 (<a href="https://codeberg.org/nobody/LocalCDN/issues/781">#781</a>)</li>
|
||||
</ul>
|
||||
<p>Fixed</p>
|
||||
<ul>
|
||||
<li>Incorrect insertion of the UTF8 charset in the HTML filter (<a href="https://codeberg.org/nobody/LocalCDN/issues/782">#782</a>)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="generator-section">
|
||||
<div class="topic-label">
|
||||
|
|
Loading…
Reference in New Issue