Skip to content

Commit 8517cce

Browse files
committed
_security update failures using nano
Error: Attachment name '_security' starts with prohibited character '_'
1 parent 0d737cc commit 8517cce

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

lib/corpus.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ function addRoleToUserInfo({
3333
};
3434

3535
debug(`${new Date()} In addRoleToUser ${JSON.stringify(userPermission)} to ${userPermission.username} on ${connection.dbname}`);
36-
const connect = `${couchConnectUrl}/_users`;
3736
const db = nano({
3837
headers: {
3938
'x-request-id': req.id,
4039
},
41-
url: connect,
42-
});
40+
url: couchConnectUrl,
41+
}).use('_users');
4342
const userid = `org.couchdb.user:${userPermission.username}`;
4443
return db.get(userid)
4544
.then((body) => {
@@ -319,8 +318,8 @@ function createNewCorpus({
319318
headers: {
320319
'x-request-id': req.id || '',
321320
},
322-
url: `${couchConnectUrl}/${corpusObject.dbname}`,
323-
});
321+
url: couchConnectUrl,
322+
}).use(corpusObject.dbname);
324323
return server.db.create(corpusObject.dbname)
325324
.then((response) => {
326325
debug(`Created db ${corpusObject.dbname}`, response);
@@ -402,8 +401,8 @@ function createNewCorpus({
402401
headers: {
403402
'x-request-id': req.id,
404403
},
405-
url: `${couchConnectUrl}/${corpusObject.dbname}-activity_feed`,
406-
});
404+
url: couchConnectUrl,
405+
}).use(`${corpusObject.dbname}-activity_feed`);
407406
return activityDb.insert(securityParamsforNewDB, '_security');
408407
})
409408
.catch((couchDBError) => {

lib/user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ function createCouchDBUser({
140140
headers: {
141141
'x-request-id': req.id || '',
142142
},
143-
url: `${couchConnectUrl}/${user.username}-activity_feed`,
144-
});
143+
url: couchConnectUrl,
144+
}).use(`${user.username}-activity_feed`);
145145
return activityDb.insert({
146146
admins: {
147147
names: [],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"scripts": {
6565
"docker:build": "docker build -t fielddb-auth .",
6666
"docker:test": "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" } };' > config/local.js && docker compose up -d && sleep 3 && docker compose logs && npm run setup && npm run test:deprecated",
67-
"docker:test:no-cache": "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" } };' > config/local.js && docker compose build --no-cache && docker compose up -d && docker compose logs && npm run setup && npm run test:deprecated",
67+
"docker:test:no-cache": "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" } };' > config/local.js && docker compose build --no-cache && docker compose up -d && sleep 15 && docker compose logs && npm run setup && npm run test:deprecated",
6868
"coverage": "NODE_ENV=test BUNYAN_LOG_LEVEL=FATAL NODE_TLS_REJECT_UNAUTHORIZED=0 nyc npm test",
6969
"coveralls": "cat ./coverage/lcov.info | coveralls",
7070
"lint": "eslint ",

0 commit comments

Comments
 (0)