_DAVResource should have is_link() method to avoid dir_browser issues
mikespub opened this issue · 2 comments
Describe the bug
After switching to WsgiDav 4.3.0 with a custom DAV provider and resources, dir_browser always generates an error because it checks for res.is_link() - which only exists for fs_dav_provider
resources...
To Reproduce
Steps to reproduce the behavior:
- Use custom DAV provider
- Go to homepage
- See error
Expected behavior
Default is_link() method for any resource should return False to be consistent with previous behaviour, or dir_browser should check if the method exists for that resource.
Screenshots, Log-Files, Stacktrace
File ".../venv/lib/python3.11/site-packages/wsgidav/error_printer.py", line 49, in __call__
app_iter = self.next_app(environ, sub_app_start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/wsgidav/http_authenticator.py", line 225, in __call__
return self.next_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/wsgidav/dir_browser/_dir_browser.py", line 134, in __call__
context = self._get_context(environ, dav_res)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv/lib/python3.11/site-packages/wsgidav/dir_browser/_dir_browser.py", line 250, in _get_context
if res.is_link():
^^^^^^^^^^^
AttributeError: 'BTFSResource' object has no attribute 'is_link'
Environment:
WsgiDAV/4.3.0 Python/3.11.6(64 bit) Linux-5.15.0-1050-azure-x86_64-with-glibc2.31
Python from: .../venv/bin/python3.11
Which WSGI server was used (cheroot, ext-wsgiutils, gevent, gunicorn, paste, uvicorn, wsgiref, ...)?
wsgiref
Which WebDAV client was used (MS File Explorer, MS Office, macOS Finder, WinSCP, Windows, file mapping, ...)?
web browser
Additional context
Datastore DAV Provider: https://github.com/mikespub-org/mp-fs-wsgidav#try-out-wsgidav-on-google-cloud-platform
Note: as all DAV resources are virtual in this case, I'm inheriting directly from _DAVResource, not DAVCollection or DAVNonCollection. The default is_link() should apply to both...
Sorry, not sure why this issue was closed here. The commit above was only a workaround for my own DAV providers - the default should be fixed in WsgiDAV
Thanks for reporting!