Multi backend should convert URLs to bytes strings

Bug #1471795 reported by canni on 2015-07-06
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Duplicity
Undecided
Unassigned

Bug Description

Because multi backend reads it's configuration from JSON, the `url` variables are of type `unicode`.
This breaks backends such as WebDAV, WebDAV internally uses pythons `httplib` witch expects URLs as `str` not `unicode`.

Steps to Reporduce:

1) Verify that direct backup to WebDAV(s) works
2) Put WebDAV(s) config into JSON for multi backend
3) Try to execute backup

Actual result:

    Backtrace of previous error: Traceback (innermost last):
      File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 365, in inner_retry
        return fn(self, *args)
      File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 515, in put
        self.__do_put(source_path, remote_filename)
      File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 501, in __do_put
        self.backend._put(source_path, remote_filename)
      File "/usr/lib/python2.7/dist-packages/duplicity/backends/webdavbackend.py", line 410, in _put
        raise e
     UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 0: ordinal not in range(128)

Expected result:

Successful backup procedure

Suggested fix:

In multi backend do convert url variable fom JSON to byte string `url.encode('utf-8')`

Environment:

Duplicty: 0.7.03
Python 2.7.9
Ubuntu 15.04 x64

canni (darek-krk) on 2015-07-06
summary: - Multi backend should convert URLs to bytes tsrings
+ Multi backend should convert URLs to bytes srings
summary: - Multi backend should convert URLs to bytes srings
+ Multi backend should convert URLs to bytes strings
Thomas Harning (harningt) wrote :

Also experiencing this - adding the line url = url.encode("utf-8") after url = config['url'] fixes the issue.

This fix will also be in my proposed patch to allow 'multi' backend to mirror backup data vs just stripe.

Michael Terry (mterry) wrote :

This was fixed in same patch that fixed bug 1474994. (revno 1191)

Changed in duplicity:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers