fix links ending with ) in some circumstances
fix ban validation message
This commit is contained in:
parent
7efeb7f463
commit
b857ddba48
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user