Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ntraut committed Dec 13, 2023
1 parent 7ea9c02 commit f542d63
Show file tree
Hide file tree
Showing 7 changed files with 266 additions and 309 deletions.
9 changes: 3 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ module.exports = {
'rules': { 'vue/multi-word-component-names': 'off' },
'overrides': [
{
files: [
'view/brainbox/src/components/Tools.vue',
'view/brainbox/src/components/MRIPage.vue'
],
files: ['*.vue'],
rules: {
'max-lines': 'off',
'no-undef': 'off'
// 300 lines limit seems to short for *.vue files
'max-lines': 'off'
}
}
]
Expand Down
9 changes: 6 additions & 3 deletions controller/atlasmakerServer/atlasmakerServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
}
},
removeAtlasAtIndex: function (iAtlas) {
// can throw an error if me.Atlases[iAtlas] is undefined
console.log(`INFO: Removing atlas ${me.Atlases[iAtlas].filename}`);
clearInterval(me.Atlases[iAtlas].timer);
delete me.Atlases[iAtlas];
Expand Down Expand Up @@ -1133,6 +1134,8 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
// get brainPath from User object
if (!sourceUS.User) {
console.error('sourceUS.User object still not created, do not try to get brain slice');

return;
}
const brainPath = sourceUS.User.dirname + sourceUS.User.mri;

Expand Down Expand Up @@ -1346,8 +1349,8 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
try {
await Promise.all(results);
} catch (err) {
console.error('Can\'t unload atlases');
console.error(err);
throw new Error('Can\'t unload atlases');
}
},
_sendAtlasVoxelDataToUser: function (atlasdata, userSocket, flagCompress) {
Expand Down Expand Up @@ -2005,8 +2008,8 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
try {
await me.unloadAtlas(sourceUS.User.dirname, sourceUS.User.atlasFilename, sourceUS.specimenName);
} catch (err) {
console.error('Can\'t unload atlas');
console.error(err);
throw new Error('Can\'t unload atlas');
}
}
} else {
Expand Down Expand Up @@ -2058,8 +2061,8 @@ data.vox_offset: ${me.Brains[i].data.vox_offset}
try {
await me._disconnectUser({ ws });
} catch (err) {
console.error('Can\'t disconnect user');
console.error(err);
throw new Error('Can\'t disconnect user');
}
});
},
Expand Down
16 changes: 9 additions & 7 deletions controller/project/project.controller.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/* eslint-disable max-lines */
const url = require('url');
const crypto = require('crypto');
const validatorNPM = require('validator');
const { param, validationResult } = require('express-validator');
const dataSlices = require('../dataSlices/dataSlices.js');
const url = require('url');

const AsyncLock = require('async-lock');
const lock = new AsyncLock();
const { AccessType, AccessLevel, AccessControlService } = require('neuroweblab');
const _ = require('lodash');
const createDOMPurify = require('dompurify');
const { param, validationResult } = require('express-validator');
const { JSDOM } = require('jsdom');
const _ = require('lodash');
const { AccessType, AccessLevel, AccessControlService } = require('neuroweblab');
const validatorNPM = require('validator');

const { ForbiddenAccessError } = require('../../errors.js');
const dataSlices = require('../dataSlices/dataSlices.js');
const { window } = (new JSDOM('', {
features: {
FetchExternalResources: false, // disables resource loading over HTTP / filesystem
Expand Down Expand Up @@ -477,7 +479,7 @@ const insertMRInames = function (req, res, list) {
const hash = crypto.createHash('md5').update(source)
.digest('hex');

// if mri exists, and has no name, insert the name
// if mri doesn't exists, create it
if (!mri) {
mri = {
filename,
Expand Down
Loading

0 comments on commit f542d63

Please sign in to comment.