mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-10 13:51:33 +02:00
type check before escape/unescape
This commit is contained in:
@@ -32,11 +32,11 @@
|
||||
};
|
||||
|
||||
translator.escape = function(text) {
|
||||
return text.replace(/\[\[([\S]*?)\]\]/g, '\\[\\[$1\\]\\]');
|
||||
return typeof text === 'string' ? text.replace(/\[\[([\S]*?)\]\]/g, '\\[\\[$1\\]\\]') : text;
|
||||
};
|
||||
|
||||
translator.unescape = function(text) {
|
||||
return text.replace(/\\\[\\\[([\S]*?)\\\]\\\]/g, '[[$1]]');
|
||||
return typeof text === 'string' ? text.replace(/\\\[\\\[([\S]*?)\\\]\\\]/g, '[[$1]]') : text;
|
||||
};
|
||||
|
||||
translator.getLanguage = function() {
|
||||
|
||||
Reference in New Issue
Block a user