andrewleech / PyWebDAV3

Port of PyWebDAV to python3, originally from http://code.google.com/p/pywebdav/
72 stars 34 forks source link

Does not work #28

Open randomhammer opened 1 year ago

randomhammer commented 1 year ago

I installed this on a Debian Bullseye machine using the apt package. It runs, but when I try to connect with MacOS Finder I get numerous exceptions such as:

----------------------------------------
2022-12-27 23:59:36,672 INFO PROPFIND: Depth is 0, URI is b'http://tesla.lan:8008/'
----------------------------------------
Exception occurred during processing of request from ('172.16.0.21', 50296)
Traceback (most recent call last):
  File "/opt/python3.10/lib/python3.10/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/opt/python3.10/lib/python3.10/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/opt/python3.10/lib/python3.10/socketserver.py", line 747, in __init__
    self.handle()
  File "/opt/python3.10/lib/python3.10/http/server.py", line 432, in handle
    self.handle_one_request()
  File "/opt/python3.10/lib/python3.10/http/server.py", line 420, in handle_one_request
    method()
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/WebDAVServer.py", line 344, in do_PROPFIND
    DATA = b'%s\n' % pf.createResponse()
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/propfind.py", line 75, in createResponse
    df = self.create_prop()
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/propfind.py", line 160, in create_prop
    res = self.mk_prop_response(self._uri, gp, bp, doc)
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/propfind.py", line 245, in mk_prop_response
    uri = self._dataclass.baseurl + '/' + '/'.join(uri.split('/')[3:])
TypeError: a bytes-like object is required, not 'str'
----------------------------------------
2022-12-27 23:59:36,675 INFO PROPFIND: Depth is 0, URI is b'http://tesla.lan:8008/'
----------------------------------------
Exception occurred during processing of request from ('172.16.0.21', 50297)
Traceback (most recent call last):
  File "/opt/python3.10/lib/python3.10/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/opt/python3.10/lib/python3.10/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/opt/python3.10/lib/python3.10/socketserver.py", line 747, in __init__
    self.handle()
  File "/opt/python3.10/lib/python3.10/http/server.py", line 432, in handle
    self.handle_one_request()
  File "/opt/python3.10/lib/python3.10/http/server.py", line 420, in handle_one_request
    method()
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/WebDAVServer.py", line 344, in do_PROPFIND
    DATA = b'%s\n' % pf.createResponse()
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/propfind.py", line 75, in createResponse
    df = self.create_prop()
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/propfind.py", line 160, in create_prop
    res = self.mk_prop_response(self._uri, gp, bp, doc)
  File "/home/chris/webdav/venv/lib/python3.10/site-packages/pywebdav/lib/propfind.py", line 245, in mk_prop_response
    uri = self._dataclass.baseurl + '/' + '/'.join(uri.split('/')[3:])
TypeError: a bytes-like object is required, not 'str'

Over and over. Looks like unicode is broken?

andrewleech commented 1 year ago

This might be fixed by some recently merged contributions included in https://pypi.org/project/PyWebDAV3/0.10.0/

Would you mind re-testing please?