Skip to content

Commit

Permalink
Merge pull request keystonejs#4466 from Aldlevine/fix-fs-overwrite
Browse files Browse the repository at this point in the history
Fixed overwrite in Adapters.FS
  • Loading branch information
JedWatson authored Oct 23, 2017
2 parents 6271bd7 + b19c3ed commit f262c67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/storage/adapters/fs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ FSAdapter.prototype.uploadFile = function (file, callback) {
filename = sanitize(filename);
debug('Uploading file with filename: %s', filename);
var uploadPath = path.resolve(options.path, filename);
fs.move(file.path, uploadPath, function (err) {
var fsOptions = {};
fsOptions.clobber = options.whenExists === 'overwrite';
fs.move(file.path, uploadPath, fsOptions, function (err) {
if (err) return callback(err);

// TODO: Chmod the file.
Expand Down

0 comments on commit f262c67

Please sign in to comment.