Skip to content

Commit 2569a44

Browse files
authored
Bug fix for double quoted tags + decode htmlchars
Bug fix for previous commit, Decode html chars: title: "Finally, CSS In JavaScript! Meet CSSX – Smashing Magazine" ===> title: "Finally, CSS In JavaScript! Meet CSSX – Smashing Magazine"
1 parent 90352c3 commit 2569a44

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

OpenGraphParser.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import decodeHTMLChars from './decodeHTMLChars';
2+
13
function parseMeta(html) {
24
const metaTagRegex = /<meta.*property=[ '"]*og:.*/gi;
35
const meta = {
@@ -19,12 +21,12 @@ function parseMeta(html) {
1921
metaName = metaName[0];
2022
} else {
2123
metaName = metaName[0].split("'");
22-
}
2324

24-
if (metaName.length > 1) {
25-
metaName = metaName[0];
26-
} else {
27-
break;
25+
if (metaName.length > 1) {
26+
metaName = metaName[0];
27+
} else {
28+
break;
29+
}
2830
}
2931

3032
let metaValue = matches[i].split('content=');
@@ -35,7 +37,7 @@ function parseMeta(html) {
3537
break;
3638
}
3739

38-
meta[metaName] = metaValue;
40+
meta[metaName] = decodeHTMLChars(metaValue);
3941
}
4042
}
4143

0 commit comments

Comments
 (0)