havardgulldahl / jottalib

A library to access files stored at jottacloud.com.
GNU General Public License v3.0
83 stars 19 forks source link

Strange behavior when downloading file within a folder that contains "+" signs #103

Closed antonhagg closed 8 years ago

antonhagg commented 8 years ago

There seems to be something causing the stream to only download the first chunk, when downloading files within a folder that has "+" within its name. The download is calling this function when downloading the file. Anyone that has an idea where to start with this? Edit: It's also the case with files with "+" sign in the file name.

    with open(remote_file.name, 'wb') as fh:
        bytes_read = 0
        with ProgressBar(expected_size=total_size) as bar:
            for chunk_num, chunk in enumerate(remote_file.stream()):
                fh.write(chunk)
                bytes_read += len(chunk)
                bar.show(bytes_read)
    print('%s downloaded successfully' % args.remotefile)
antonhagg commented 8 years ago

Have found the problem. In the stream it did not encode the url to include quotes so i included escapeUrl in there, and it works now.

antonhagg commented 8 years ago

Not sure if this was fixed in 0.5, and related to #115. Can't test the new version at the moment.

havardgulldahl commented 8 years ago

The current tests in test_JFS.test_urlencoded_filename now check for + signs, and they're passing: https://github.com/havardgulldahl/jottalib/blob/master/tests/test_JFS.py#L189

So I'm considering this fixed, but please reopen if you still have issues here.