-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
I ran into an issue with davserver when specifying an explicit baseurl, from either the -B
command-line flag or via config file:
2019-12-01 02:01:10,274 INFO Starting up PyWebDAV server (version 0.9.14)
2019-12-01 02:01:10,274 INFO chunked_http_response feature ON
2019-12-01 02:01:10,274 INFO http_request_use_iterator feature OFF
2019-12-01 02:01:10,274 INFO http_response_use_iterator feature ON
2019-12-01 02:01:10,274 INFO Initialized with /home/jayson/wut_it_be http://localhost:8081/
2019-12-01 02:01:10,274 WARNING Authentication disabled!
2019-12-01 02:01:10,274 INFO Serving data from /home/jayson/wut_it_be
2019-12-01 02:01:10,274 INFO Using http://skully:8081 as base url for PROPFIND requests
Listening on localhost (8081)
127.0.0.1 - - [01/Dec/2019 02:01:12] "OPTIONS / HTTP/1.1" 200 -
2019-12-01 02:01:12,058 INFO PROPFIND: Depth is 0, URI is b'http://localhost:8081/'
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 56366)
Traceback (most recent call last):
File "/usr/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/usr/lib/python3.7/http/server.py", line 426, in handle
self.handle_one_request()
File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
method()
File "/usr/local/lib/python3.7/dist-packages/PyWebDAV3-0.9.14-py3.7.egg/pywebdav/lib/WebDAVServer.py", line 344, in do_PROPFIND
DATA = b'%s\n' % pf.createResponse()
File "/usr/local/lib/python3.7/dist-packages/PyWebDAV3-0.9.14-py3.7.egg/pywebdav/lib/propfind.py", line 75, in createResponse
df = self.create_prop()
File "/usr/local/lib/python3.7/dist-packages/PyWebDAV3-0.9.14-py3.7.egg/pywebdav/lib/propfind.py", line 160, in create_prop
res = self.mk_prop_response(self._uri, gp, bp, doc)
File "/usr/local/lib/python3.7/dist-packages/PyWebDAV3-0.9.14-py3.7.egg/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'
Looks like the culprit is line 245 in pywebdav/lib/propfind.py
. The data contained in self._dataclass.baseurl
is of type str
, but the rest of the function expects bytes
.
I've made a fix and submitted it as a pull request.
It also adds an empty baseurl
configuration directive to the example config.ini, as I found that davserver would refuse to run unless that directive was present.
PS. I'm glad to see this fork exists, I was halfway through figuring out how to convert the old PyWebDAV codebase over to Python 3 when I found this!
--Jays
Metadata
Metadata
Assignees
Labels
No labels