Skip to content

Commit

Permalink
Merge pull request #860 from veliovgroup/dev
Browse files Browse the repository at this point in the history
πŸ“¦ v2.3.2

- πŸ‘¨β€πŸ’» Potential fix for #857 (windows)
  • Loading branch information
dr-dimitru authored Nov 3, 2022
2 parents df7a6c9 + 39044bc commit 4f58852
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .versions
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ostrio:files',
version: '2.3.1',
version: '2.3.2',
summary: 'Upload files to a server or 3rd party storage: AWS:S3, GridFS, DropBox, and other',
git: 'https://github.com/veliovgroup/Meteor-Files',
documentation: 'README.md'
Expand Down
9 changes: 5 additions & 4 deletions write-stream.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs-extra';
import nodePath from 'path';
import { Meteor } from 'meteor/meteor';
import { helpers } from './lib.js';
const noop = () => {};
Expand Down Expand Up @@ -42,18 +43,18 @@ export default class WriteStream {
fs.stat(this.path, (statError, stats) => {
bound(() => {
if (statError || !stats.isFile()) {
const paths = this.path.split('/');
const paths = this.path.split(nodePath.sep);
paths.pop();
try {
fs.mkdirSync(paths.join('/'), { recursive: true });
fs.mkdirSync(paths.join(nodePath.sep), { recursive: true });
} catch (mkdirError) {
throw new Meteor.Error(500, `[FilesCollection] [writeStream] [constructor] [mkdirSync] ERROR: can not make/ensure directory ${paths.join('/')}`, mkdirError);
throw new Meteor.Error(500, `[FilesCollection] [writeStream] [constructor] [mkdirSync] ERROR: can not make/ensure directory "${paths.join(nodePath.sep)}"`, mkdirError);
}

try {
fs.writeFileSync(this.path, '');
} catch (writeFileError) {
throw new Meteor.Error(500, `[FilesCollection] [writeStream] [constructor] [writeFileSync] ERROR: can not write file ${this.path}`, writeFileError);
throw new Meteor.Error(500, `[FilesCollection] [writeStream] [constructor] [writeFileSync] ERROR: can not write file "${this.path}"`, writeFileError);
}
}

Expand Down

0 comments on commit 4f58852

Please sign in to comment.