From b857ddba484bf1ff431f49e4bb33b370bc474b5e Mon Sep 17 00:00:00 2001 From: HF Date: Sun, 7 Aug 2022 02:24:53 +0200 Subject: [PATCH] fix links ending with ) in some circumstances fix ban validation message --- src/components/ModIIDtools.jsx | 2 +- src/core/MString.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ModIIDtools.jsx b/src/components/ModIIDtools.jsx index 27f64b8..66f5295 100644 --- a/src/components/ModIIDtools.jsx +++ b/src/components/ModIIDtools.jsx @@ -16,7 +16,7 @@ async function submitIIDAction( ) { let time = parseInterval(duration); if (time === 0 && duration !== '0') { - callback(t`You must enter an IID`); + callback(t`You must enter a duration`); return; } if (!iid) { diff --git a/src/core/MString.js b/src/core/MString.js index e451a86..137b561 100644 --- a/src/core/MString.js +++ b/src/core/MString.js @@ -153,7 +153,7 @@ export default class MString { // set this.iter temporarily to be able to use thischeckIfLink const oldIter = this.iter; this.iter = zEnd; - z = this.checkIfLink(); + z = this.checkIfLink(true); zEnd = this.iter; this.iter = oldIter; if (z === null) { @@ -193,7 +193,7 @@ export default class MString { * returns the link or false if there is none * moves iter forward to after the link, if there's one */ - checkIfLink() { + checkIfLink(enclosure = false) { let cIter = this.iter; if (!this.txt.startsWith('://', cIter) || cIter < 3) { return null; @@ -208,7 +208,7 @@ export default class MString { cIter += 3; for (; cIter < this.txt.length && !MString.isWhiteSpace(this.txt[cIter]) - && this.txt[cIter] !== ')'; cIter += 1 + && (!enclosure || this.txt[cIter] !== ')'); cIter += 1 ); if (cIter < this.iter + 4) { return null;