mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 04:06:51 +00:00
Fix a crasher in the serializer
A tail containing regexp syntax (a ? in [[:en:Main Page]]) would crash the serializer. Use substr instead. Change-Id: I8519aec9c07dfe31893d676b1c936a42d2af74a0
This commit is contained in:
parent
d01581c380
commit
4533c274ca
|
@ -414,7 +414,9 @@ WSP._serializeToken = function ( state, token ) {
|
||||||
state.precedingNewlineCount = 0;
|
state.precedingNewlineCount = 0;
|
||||||
}
|
}
|
||||||
if ( ! dropContent || ! state.dropContent ) {
|
if ( ! dropContent || ! state.dropContent ) {
|
||||||
if (state.linkTail) res = res.replace(new RegExp(state.linkTail + "$"), "");
|
if (state.linkTail && res.substr(- state.linkTail.length) === state.linkTail) {
|
||||||
|
res = res.substr(0, res.length - state.linkTail.length);
|
||||||
|
}
|
||||||
state.chunkCB( res );
|
state.chunkCB( res );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue