mirror of https://gitee.com/bigwinds/arangodb
fixed collection prefix for users and sessions
This commit is contained in:
parent
13a45f56f5
commit
a3892fb672
|
@ -7,4 +7,4 @@
|
|||
if (db._collection(usersName) === null) {
|
||||
db._create(usersName, {isSystem: true});
|
||||
}
|
||||
}());
|
||||
}());
|
||||
|
|
|
@ -194,12 +194,15 @@ function extendContext (context, app, root) {
|
|||
var cp = context.collectionPrefix;
|
||||
var cname = "";
|
||||
|
||||
if (cp !== "") {
|
||||
if (cp === "_") {
|
||||
cname = "_";
|
||||
}
|
||||
else if (cp !== "") {
|
||||
cname = cp + "_";
|
||||
}
|
||||
|
||||
context.collectionName = function (name) {
|
||||
var replaced = (cname + name).replace(/[^a-zA-Z0-9]/g, '_').replace(/(^_+|_+$)/g, '').substr(0, 64);
|
||||
var replaced = cname + name.replace(/[^a-zA-Z0-9]/g, '_').replace(/(^_+|_+$)/g, '').substr(0, 64);
|
||||
|
||||
if (replaced.length === 0) {
|
||||
throw new Error("Cannot derive collection name from '" + name + "'");
|
||||
|
|
Loading…
Reference in New Issue