Skip to content

Commit

Permalink
fixed path sep on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ldarren committed May 30, 2018
1 parent 54d45bc commit cbe0702
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/fileinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ FileInfo.prototype = {
if (!that.hasVersionImages()) return;
var baseUrl = URL.parse(that.url);
baseUrl.search = undefined;
var pathname = path.dirname(baseUrl.pathname);
var pathname = path.posix.dirname(baseUrl.pathname);
Object.keys(storage.imageVersions).forEach(function(version) {
baseUrl.pathname = path.join(pathname, version, that.name);
baseUrl.pathname = path.posix.join(pathname, version, that.name);
that[version + 'Url'] = URL.format(baseUrl);
});
return;
Expand Down
10 changes: 5 additions & 5 deletions lib/transport/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function getURL(s3, key, config){

function uploadFile(s3, fileName, fileBuffer, storage, callback) {
var metaData = getContentTypeByFile(fileName);
var remoteFilename = path.join(storage.uploadDir, fileName);
var remoteFilename = path.posix.join(storage.uploadDir, fileName);
var config = storage.config;
var params = {
ACL: config.acl,
Expand Down Expand Up @@ -123,7 +123,7 @@ module.exports = function (opts, storage){
url: getURL(s3, o.Key, config)
};
var fileInfo = new FileInfo({
name: path.basename(o.Key),
name: path.posix.basename(o.Key),
size: o.Size,
lastMod: o.LastModified,
awsFile:sss
Expand All @@ -149,7 +149,7 @@ module.exports = function (opts, storage){

var count = Object.keys(storage.imageVersions).length;
thumbnail(fileInfo, fileBuffer, storage.imageVersions, function(version, buffer){
uploadFile(s3, path.join(version, fileInfo.name), buffer, storage, function(err, awsFile){
uploadFile(s3, path.posix.join(version, fileInfo.name), buffer, storage, function(err, awsFile){
if (0 >= --count){
fileInfo.proccessed = true;
fileInfo.initUrls(opts, storage);
Expand All @@ -165,15 +165,15 @@ module.exports = function (opts, storage){
delete:function(req,res,callback){
var params = {
Bucket: config.bucketName,
Key: decodeURIComponent(path.join(storage.uploadDir, path.basename(req.url)))
Key: decodeURIComponent(path.posix.join(storage.uploadDir, path.posix.basename(req.url)))
};
s3.deleteObject(params, function(err, data) {
if (err) return callback(err);
if (storage.imageVersions){
Object.keys(storage.imageVersions).forEach(function(version) {
params = {
Bucket: config.bucketName,
Key: decodeURIComponent(path.join(storage.uploadDir, version, path.basename(req.url)))
Key: decodeURIComponent(path.posix.join(storage.uploadDir, version, path.posix.basename(req.url)))
};
// TODO - Missing callback
s3.deleteObject(params, function(err, data) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload-expressjs",
"version": "0.6.3",
"version": "0.6.4",
"description": "jQuery File Upload using Expressjs : 'borrowed' from Blueimp jQuery File Upload developed by Sebastian Tschan",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit cbe0702

Please sign in to comment.