Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading via src #109

Open
lipatoff opened this issue Feb 6, 2018 · 1 comment
Open

Error loading via src #109

lipatoff opened this issue Feb 6, 2018 · 1 comment
Labels

Comments

@lipatoff
Copy link

lipatoff commented Feb 6, 2018

My code:

var conn = ftp.create({
		host:     '***',
		user:     '***',
		password: '***',
		parallel: 5,
		log: gutil.log
	});

gulp.task('load', function () {
	return conn.src('/mysite/project.zip')
	.pipe(gulp.dest('zip'));
});

But, after upgrading to version 6, I get:

CONN
READY
MLSD /mysite
LIST /mysite
GET \mysite\project.zip

when it should be:
GET /mysite/project.zip

How to fix it?

@c512970
Copy link

c512970 commented Mar 9, 2018

I ran into the same problem, tried to find the answer to this question in google, but found only this issue without an answer. Therefore I had to solve the problem myself :)

ATTENTION!!!
I understand that this is a very bad decision, but I do not know how to do it right.
In order for .src to start working, you need to

  1. Open the file node_modules/vinyl-ftp/lib/src.js
  2. Find in this file the line "function getContents (file, cb) {"
  3. Insert after this line the following code:
let fixedFilePath = file.path;
fixedFilePath = fixedFilePath.replace (/\\/ g, "\/");
  1. Replace the lines
    if (options.buffer) return self.downbuffer (file.path, onContents);
    and
    self.downstream (file.path, onContents);
    on
    if (options.buffer) return self.downbuffer (fixedFilePath, onContents);
    self.downstream (fixedFilePath, onContents);
    respectively

I noted the changes on this picture:
https://i.imgur.com/tKpRa7g.png

ATTENTION!!!
I remind you that this is a bad solution, because every time you reinstall vinyl-ftp, you will need to do it again. But, nevertheless, it works.

P.S. Sorry for my english.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants