havardgulldahl / jottalib

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

jotta-share is broken #105

Open roflmao opened 8 years ago

roflmao commented 8 years ago

jottalib (0.4.2-1)

$ jotta-share lol.json
Traceback (most recent call last):
  File "/usr/local/bin/jotta-share", line 9, in <module>
    load_entry_point('jottalib==0.4.2-1', 'console_scripts', 'jotta-share')()
  File "/usr/local/lib/python2.7/dist-packages/jottalib/cli.py", line 165, in share
    jottadev = get_jotta_device(jfs)
  File "/usr/local/lib/python2.7/dist-packages/jottalib/cli.py", line 62, in get_jotta_device
    for j in jfs.devices: # find Jotta/Shared folder
  File "/usr/local/lib/python2.7/dist-packages/jottalib/JFS.py", line 984, in devices
    return self.fs is not None and [JFSDevice(d, self, parentpath=self.rootpath) for d in self.fs.devices.iterchildren()] or [x for x in []]
  File "/usr/local/lib/python2.7/dist-packages/jottalib/JFS.py", line 661, in __init__
    self.mountPoints = {unicode(mp.name):mp for mp in self.mountpointobjects()}
  File "/usr/local/lib/python2.7/dist-packages/jottalib/JFS.py", line 675, in mountpointobjects
    return [ JFSMountPoint(obj, self._jfs, self.path) for obj in self.contents().mountPoints.iterchildren() ]
  File "/usr/local/lib/python2.7/dist-packages/jottalib/JFS.py", line 670, in contents
    c = self._jfs.get('%s%s' % (self.path, path or '/'))
  File "/usr/local/lib/python2.7/dist-packages/jottalib/JFS.py", line 838, in get
    url = self.escapeUrl(url)
  File "/usr/local/lib/python2.7/dist-packages/jottalib/JFS.py", line 807, in escapeUrl
    url = quote(urlparts[0], safe=self.rootpath)
  File "/usr/lib/python2.7/urllib.py", line 1288, in quote
    return ''.join(map(quoter, s))
KeyError: u'\u2019'
havardgulldahl commented 8 years ago

Thank you for your report!

The current code does not properly handle unicode/bytestrings, and I highly suspect that is the cause here. Are you trying to share a file from a path that has non-ascii characters?

havardgulldahl commented 8 years ago

And now I just figured out that Jottacloud has gone and changed the sharing API, see #94.

So we have to fix that first.