reddit regex will match without ending /

This commit is contained in:
Yisrael Dov Lebow 🐻 2020-10-01 14:18:38 +03:00
parent 957b9e4348
commit 0491c3db38

View file

@ -579,7 +579,7 @@ async function verifyProof(url, fingerprint) {
// Reddit // Reddit
if (/^https:\/\/(?:www\.)?reddit\.com\/user/.test(url)) { if (/^https:\/\/(?:www\.)?reddit\.com\/user/.test(url)) {
output.type = "reddit"; output.type = "reddit";
match = url.match(/https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\//); match = url.match(/https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/([^/]*)/);
output.display = match[1]; output.display = match[1];
output.url = `https://www.reddit.com/user/${match[1]}`; output.url = `https://www.reddit.com/user/${match[1]}`;
output.proofUrl = `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`; output.proofUrl = `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`;