pearu / ftpsync2d

Automatically exported from code.google.com/p/ftpsync2d
6 stars 3 forks source link

Problem uploading files with ":" in the filename #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I'm running the script to sync a folder with one or more filenames 
with colon in it.

For example: 
photos/album1:picture1.jpg
photos/album1:picture2.jpg
photos/album2:picture1.jpg

The script raises an exception saying that the a lambda function should 
receive 2 arguments but is receiving 3 instead.
It happens because there is a split(":") to get the file size for each one 
of the lines which break the filename in the middle.

This is happening in the version 1.0 but in a quick check in the SVN 
version seems to have the same problem.

The fix I'm using is replace the split by a rsplit with a limit of 1 as 
follow:

- return dict([func(*line.rsplit(':', 1)) for line in l.splitlines()])
+ return dict([func(*line.split(':')) for line in l.splitlines()])

Let me know if you need any further info.

Original issue reported on code.google.com by seocam on 23 Feb 2010 at 5:46

GoogleCodeExporter commented 9 years ago
I'm sorry, I switched the plus with0 the minus. It should be:

- return dict([func(*line.split(':')) for line in l.splitlines()])
+ return dict([func(*line.rsplit(':', 1)) for line in l.splitlines()])

Original comment by seocam on 23 Feb 2010 at 5:47

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r7.

Original comment by pearu.peterson on 26 Feb 2010 at 7:28