1
0
Fork 0

strip illegal characters from collection names

This commit is contained in:
Jan Steemann 2015-02-20 15:46:27 +01:00
parent 9536857060
commit e3a4ee8a7b
1 changed files with 2 additions and 1 deletions

View File

@ -98,7 +98,8 @@
}; };
AppContext.prototype.collectionName = function (name) { AppContext.prototype.collectionName = function (name) {
var replaced = this.collectionPrefix + name.replace(/[^a-zA-Z0-9]/g, '_').replace(/(^_+|_+$)/g, '').substr(0, 64); var replaced = this.collectionPrefix.replace(/[:\.]+/g, '_') +
name.replace(/[^a-zA-Z0-9]/g, '_').replace(/(^_+|_+$)/g, '').substr(0, 64);
if (replaced.length === 0) { if (replaced.length === 0) {
throw new Error("Cannot derive collection name from '" + name + "'"); throw new Error("Cannot derive collection name from '" + name + "'");