ember-cli-deploy / ember-cli-deploy-s3

An ember-cli-deploy plugin to upload to s3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backslashes mess up deploying to S3 on Windows

Awem opened this issue · comments

I am running Windows 7, 64 bit and am deploying with ember-cli-deploy 0.5.1 & ember-cli 1.13.8 to S3. Builds in deploy-dist are fine, but on uploading assets the backslashes are not converted to slashes. Thus, in my bucket I have a file named like assets\vendor-94d0c52583a18e95729ebf70f10f3ade.js instead of vendor-94d0c52583a18e95729ebf70f10f3ade.js in the folder assets.
BTW, I am using lightning-pack 0.2.0, which provides ember-cli-deploy-s3 0.1.0.

There is a quick and dirty fix for all of you who run into the same issue with version 0.1.0. Edit the file ember-cli-deploy-s3/lib/s3.js and find the line containing:

var key = path.join(prefix, filePath);

To make sure that the statement produces a string with a slash separator instead of a backslash you change the line into this.

var key = path.join(prefix, filePath).replace('\\','/');

Thanks, but one should use

var key = path.join(prefix, filePath).replace(/\\/g, '/')

instead, because this will replace all occurences of \.
Alternatively, one can use https://github.com/sindresorhus/slash or https://github.com/anodynos/upath.

@Awem sorry for the delay

it's a bit hard for us to reproduce

are you interested in opening a PR with a fix that will work on all platforms?

Closing for lack of activity.