Skip to content

Commit

Permalink
Update dataHandlers.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CGDogan committed Sep 16, 2023
1 parent c54c826 commit 7f62a32
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions handlers/dataHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,15 @@ FSChanged.added = function(req, res) {
var identifier;
if (parentDir == '.') {
// This is a single file not in any subfolder, and does not have companion files
identifier = query.filepath
identifier = query.filepath;
} else {
// This is a file in a subdirectory.
// caMicroscope design decision: every subdir in the images directory is one image
// so traverse up if needed.
do {
identifier = parentDir;
parentDir = path.dirname(parentDir);
} while(parentDir != '.');
} while (parentDir != '.');
}

// Here, we can be more fault tolerant and handle the case that despite still being an entry,
Expand Down Expand Up @@ -482,7 +482,7 @@ FSChanged.removed = function(req, res) {
try {
var metadata = await fetch("http://ca-load:4000/data/one/" + query.filepath);
metadata = await metadata.json();
} catch(e) {
} catch (e) {
res.send({error: "slideloader failure"});
console.log(e);
return;
Expand All @@ -505,15 +505,15 @@ FSChanged.removed = function(req, res) {
do {
identifier = parentDir;
parentDir = path.dirname(parentDir);
} while(parentDir != '.');
} while (parentDir != '.');
var basename = path.basename(query.filepath);
// get folder contents. Pick any replacements from the array.
// if no other files in the folder, delete db entries
try {
var contents = await fetch("http://ca-load:4000/data/folder/" + identifier);
contents = await contents.json();
contents = contents.contents;
} catch(e) {
} catch (e) {
res.send({error: "slideloader failure"});
console.log(e);
return;
Expand All @@ -529,7 +529,7 @@ FSChanged.removed = function(req, res) {
var newFilePath = identifier + '/' + contents[0];
try {
replacer = await fetch("http://ca-load:4000/data/one/" + newFilePath);
} catch(e) {
} catch (e) {
res.send({error: "slideloader failure"});
console.log(e);
return;
Expand All @@ -539,13 +539,13 @@ FSChanged.removed = function(req, res) {
res.send({error: "picked " + newFilePath + " which could not be reader"});
return;
}
replacer = {$set: replacer}
replacer = {$set: replacer};
}
}

try {
var slides = await mongoDB.find("camic", "slide");
} catch(e) {
} catch (e) {
res.send({error: "mongo failure"});
console.log(e);
return;
Expand Down

0 comments on commit 7f62a32

Please sign in to comment.