Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Destination header may be quoted (e.g. DAV Explorer sends unquoted,
# Windows quoted)
destinationHeader = compat.unquote(environ["HTTP_DESTINATION"])
# Return fragments as part of
def _get_context(self, environ, dav_res):
"""
@see: http://www.webdav.org/specs/rfc4918.html#rfc.section.9.4
"""
assert dav_res.is_collection
is_readonly = environ["wsgidav.provider"].is_readonly()
context = {
"htdocs": (self.config.get("mount_path") or "") + ASSET_SHARE,
"rows": [],
"version": __version__,
"display_path": compat.unquote(dav_res.get_href()),
"url": dav_res.get_href(), # util.make_complete_url(environ),
"parent_url": util.get_uri_parent(dav_res.get_href()),
"config": self.dir_config,
"is_readonly": is_readonly,
"access": "read-only" if is_readonly else "read-write",
"is_authenticated": False,
}
trailer = self.dir_config.get("response_trailer")
if trailer is True:
trailer = "${version} - ${time}"
if trailer:
trailer = trailer.replace(
"${version}",
"<a href="https://github.com/mar10/wsgidav/">WsgiDAV/{}</a>".format(
def ref_url_to_path(self, ref_url):
"""Convert a refUrl to a path, by stripping the share prefix.
Used to calculate the
def __init__(self, config):
self.config = copy.deepcopy(DEFAULT_CONFIG)
util.deep_update(self.config, config)
config = self.config
# Evaluate configuration and set defaults
_check_config(config)
self.verbose = config.get("verbose", 3)
hotfixes = config.get("hotfixes", {})
self.re_encode_path_info = hotfixes.get("re_encode_path_info", None)
if self.re_encode_path_info is None:
self.re_encode_path_info = compat.PY3
self.unquote_path_info = hotfixes.get("unquote_path_info", False)
lock_storage = config.get("lock_manager")
if lock_storage is True:
lock_storage = LockStorageDict()
if not lock_storage:
self.lock_manager = None
else:
self.lock_manager = LockManager(lock_storage)
self.prop_manager = config.get("property_manager")
if not self.prop_manager:
# Normalize False, 0 to None
self.prop_manager = None