Skip to content

Commit 5fd4ed5

Browse files
committed
Added check for existence of file in api path '/disseminate'
1 parent 9cfc34f commit 5fd4ed5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/danrw.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ function dawebAuthenticate(params) {
101101
function getDip(params) {
102102
var filePath = path.join(config.userArea, config.daweb.user, 'outgoing', params.identifier + '.tgz');
103103
// TODO error handling if file does not exist
104-
105-
params.success(filePath);
104+
fs.exists(filePath, function (exists) {
105+
if (exists) {
106+
params.success(filePath);
107+
} else {
108+
params.error(404, "File not found");
109+
}
110+
});
106111
}
107112

108113

0 commit comments

Comments
 (0)