Skip to content

ls() fails on Nextcloud server #55

@schferbe

Description

@schferbe

When I run the ls() command with a connection to a Nextcloud server parts of my stacktrace look like this:

  File "/usr/lib/python3.6/site-packages/easywebdav/client.py", line 184, in ls
    return [elem2file(elem) for elem in tree.findall('{DAV:}response')]
  File "/usr/lib/python3.6/site-packages/easywebdav/client.py", line 184, in <listcomp>
    return [elem2file(elem) for elem in tree.findall('{DAV:}response')]
  File "/usr/lib/python3.6/site-packages/easywebdav/client.py", line 40, in elem2file
    int(prop(elem, 'getcontentlength', 0)),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

It seems as if not content length for directories is provided. I solved the issue by changing the return statement of prop in client.py to return default if child is None or child.text is None else child.text.
I'll be submitting a pull request for this shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions