Skip to content

Commit

Permalink
[FIX] App crashes when downloads come from WebDAV and the server is n…
Browse files Browse the repository at this point in the history
…ot available (#21985)
  • Loading branch information
KevLehman authored May 20, 2021
1 parent 53e42fb commit 44d1df1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/file-upload/server/config/Webdav.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ import { settings } from '../../../settings';
import '../../ufs/Webdav/server.js';

const get = function(file, req, res) {
this.store.getReadStream(file._id, file).pipe(res);
this.store.getReadStream(file._id, file)
.on('error', () => {
console.error('An error ocurred when fetching the file');
res.writeHead(503);
res.end();
})
.on('data', (chunk) => {
res.write(chunk);
})
.on('end', res.end.bind(res));
};

const copy = function(file, out) {
Expand Down

0 comments on commit 44d1df1

Please sign in to comment.