Skip to content

Commit

Permalink
Fix bug introduced in prev. commit that would have made files get upl…
Browse files Browse the repository at this point in the history
…oaded to the wrong place.
  • Loading branch information
mikermcneil committed Aug 17, 2018
1 parent 579a0e7 commit 9cce037
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion standalone/build-disk-receiver-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ module.exports = function buildDiskReceiverStream(options, adapter) {
// to Readable streams that come from the filesystem. So this kinda messed
// us up. And we had to do this instead:
var skipperFd = __newFile.skipperFd || (_.isString(__newFile.fd)? __newFile.fd : undefined);
if (!_.isString(skipperFd)) {
return done(new Error('In skipper-disk adapter, write() method called with a stream that has an invalid `skipperFd`: '+skipperFd));
}

// If fd DOESNT have leading slash, resolve the path
// from process.cwd()
if (!skipperFd.match(/^\//)) {
__newFile.skipperFd = path.resolve(process.cwd(), '.tmp/uploads', skipperFd);
skipperFd = path.resolve(process.cwd(), '.tmp/uploads', skipperFd);
__newFile.skipperFd = skipperFd;
}

// Ensure necessary parent directories exist:
Expand Down

2 comments on commit 9cce037

@kurmanka
Copy link

@kurmanka kurmanka commented on 9cce037 Aug 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @mikermcneil,

in a sails app, with skipper-disk v.5.0.12 I get this error when attempting a file upload:

Error: ENOENT: no such file or directory, open '1cbc76a3-36b7-407c-ba8c-5e801fc0ffd1.psd'
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '1cbc76a3-36b7-407c-ba8c-5e801fc0ffd1.psd'

If I install v.5.0.11 this error goes away and uploads work. It appears as if the uploads are being looked at a wrong place, they should be opened in .tmp/uploads/, not in the current directory. Should I create an issue?

(Mac OS X, node v8.9.4, sails v.0.12.14, skipper v.0.7.6)

@benoitbzl
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I am facing the same problem as @kurmanka with version 0.5.12.

Please sign in to comment.