Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mar10/wsgidav
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Nov 3, 2022
2 parents df0da73 + b96f07f commit 2d53452
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
## 4.0.3 / Unreleased
- #246 Add dir_browser/htdocs folder setup.cfg (for install with `pip install .`)
- #265 Fix PAM not threadsafe
- #268 Use relative paths to support reverse proxies

## 4.0.2 / 2022-08-01

- #245: Add charset utf-8 to Content-Type header
- #246 Add dir_browser/htdocs folder to sdist (.tar.gz)
- #248 Provider does not support set_last_modified" error
- #251 Fix removing locks in recursive mode
Expand Down Expand Up @@ -43,7 +45,8 @@

**Other changes**

- Provider root paths are evaluated relative to the location of the configuration file
- Provider root paths are evaluated relative to the location of the configuration
file
- DAVCollection, DAVNonCollection, DAVProvider are now ABCs.
- Deprecate hotfixes.winxp_accept_root_share_login and hotfixes.win_accept_anonymous_options
- DirBrowser supports `?davmount` URLs by default (option `dir_browser.davmount`).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![StackOverflow: WsgiDAV](https://img.shields.io/badge/StackOverflow-WsgiDAV-blue.svg)](https://stackoverflow.com/questions/tagged/WsgiDAV)


[![Open in Visual Studio Code](https://img.shields.io/badge/--007ACC?logo=visual%20studio%20code&logoColor=ffffff) Open in Visual Studio Code (experimental)](https://open.vscode.dev/mar10/wsgidav)
[![Edit online in vscode.dev](https://img.shields.io/badge/--007ACC?logo=visual%20studio%20code&logoColor=ffffff) Open in Visual Studio Code (experimental)](https://open.vscode.dev/mar10/wsgidav)

<!-- [![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/mar10/wsgidav) -->

Expand Down
15 changes: 12 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ Linux / macOS
-------------

Releases are hosted on `PyPI <https://pypi.python.org/pypi/WsgiDAV>`_ and can
be installed using `pip <http://www.pip-installer.org/>`_::
be installed using `pip <http://www.pip-installer.org/>`_.
Using a virtual environment is recommend::

$ mkdir wsgidav_test
$ cd wsgidav_test
$ wsgidav_test % python -m venv .venv
$ wsgidav_test % source .venv/bin/activate
$ (.venv) wsgidav_test % python -m pip install -U pip
$ (.venv) wsgidav_test % python -m pip install wsgidav cheroot lxml
$ (.venv) wsgidav_test % wsgidav --root . --auth anonymous --browse

$ pip install --upgrade wsgidav

Or install the latest (potentially unstable) development version directly
from GitHub::
Expand All @@ -65,7 +73,8 @@ Install lxml (optional)::
If everything is cool, this should work now::

$ wsgidav --version -v
WsgiDAV/2.4.0 Python/3.6.1 Darwin-17.5.0-x86_64-i386-64bit
WsgiDAV/4.0.1 Python/3.9.1(64 bit) macOS-12.1-x86_64-i386-64bit
Python from: /Users/joe/prj/git/test_pip/.venv/bin/python
$ wsgidav --help


Expand Down
Binary file not shown.
14 changes: 7 additions & 7 deletions wsgidav/dir_browser/_dir_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from wsgidav import __version__, util
from wsgidav.dav_error import HTTP_MEDIATYPE_NOT_SUPPORTED, HTTP_OK, DAVError
from wsgidav.mw.base_mw import BaseMiddleware
from wsgidav.util import safe_re_encode
from wsgidav.util import get_uri_name, safe_re_encode

__docformat__ = "reStructuredText"

Expand Down Expand Up @@ -182,9 +182,7 @@ def _get_context(self, environ, dav_res):
if trailer:
trailer = trailer.replace(
"${version}",
"<a href='https://github.com/mar10/wsgidav/'>WsgiDAV/{}</a>".format(
__version__
),
f"<a href='https://github.com/mar10/wsgidav/'>WsgiDAV/{__version__}</a>",
)
trailer = trailer.replace("${time}", util.get_rfc1123_time())

Expand All @@ -202,6 +200,8 @@ def _get_context(self, environ, dav_res):
for res in childList:
di = res.get_display_info()
href = res.get_href()
# #268 Use relative paths to support reverse proxies:
rel_href = get_uri_name(href)
ofe_prefix = None
tr_classes = []
a_classes = []
Expand All @@ -214,11 +214,11 @@ def _get_context(self, environ, dav_res):
ms_office_type = MS_OFFICE_EXT_TO_TYPE_MAP.get(ext)
if ms_office_type:
if ms_sharepoint_support:
ofe_prefix = "ms-{}:ofe|u|".format(ms_office_type)
ofe_prefix = f"ms-{ms_office_type}:ofe|u|"
a_classes.append("msoffice")
if libre_office_support:
add_link_html.append(
f"<a class='edit2' title='Edit with Libre Office' href='vnd.libreoffice.command:ofv|u|{href}'>Edit</a>"
f"<a class='edit2' title='Edit with Libre Office' href='vnd.libreoffice.command:ofv|u|{rel_href}'>Edit</a>"
)
# ofe_prefix_2 = "vnd.libreoffice.command:ofv|u|"
# a_classes.append("msoffice")
Expand All @@ -232,7 +232,7 @@ def _get_context(self, environ, dav_res):
a_classes.append("msoffice")

entry = {
"href": href,
"href": rel_href,
"ofe_prefix": ofe_prefix,
"a_class": " ".join(a_classes),
"add_link_html": "".join(add_link_html),
Expand Down
2 changes: 1 addition & 1 deletion wsgidav/dir_browser/htdocs/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h1>
{%- if parent_url %}
<tr class="directory">
<td>
<a href="{{ parent_url }}">..</a>
<a href="..">..</a>
</td>
<td>Directory</td>
<td>-</td>
Expand Down

0 comments on commit 2d53452

Please sign in to comment.