Skip to content

Commit

Permalink
fix: Use move-file instead of rename
Browse files Browse the repository at this point in the history
  • Loading branch information
meltyshev committed Aug 26, 2022
1 parent 212fb8a commit 5b64d46
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
6 changes: 2 additions & 4 deletions server/api/helpers/attachments/process-uploaded-file.js
@@ -1,13 +1,11 @@
const fs = require('fs');
const path = require('path');
const util = require('util');
const rimraf = require('rimraf');
const moveFile = require('move-file');
const filenamify = require('filenamify');
const { v4: uuid } = require('uuid');
const sharp = require('sharp');

const rename = util.promisify(fs.rename);

module.exports = {
inputs: {
file: {
Expand All @@ -26,7 +24,7 @@ module.exports = {
const filePath = path.join(rootPath, filename);

fs.mkdirSync(rootPath);
await rename(inputs.file.fd, filePath);
await moveFile(inputs.file.fd, filePath);

const image = sharp(filePath);
let metadata;
Expand Down
38 changes: 38 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Expand Up @@ -46,6 +46,7 @@
"knex": "^2.2.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"move-file": "^2.1.0",
"rimraf": "^3.0.2",
"sails": "^1.5.2",
"sails-hook-orm": "^4.0.1",
Expand Down

0 comments on commit 5b64d46

Please sign in to comment.