diff --git a/bottle.py b/bottle.py index 38a9732f2..cba9f44ca 100755 --- a/bottle.py +++ b/bottle.py @@ -76,6 +76,7 @@ def _cli_patch(cli_args): # pragma: no coverage from tempfile import NamedTemporaryFile from traceback import format_exc, print_exc from unicodedata import normalize +from pathlib import Path try: from ujson import dumps as json_dumps, loads as json_lds @@ -2673,6 +2674,8 @@ def save(self, destination, overwrite=False, chunk_size=2 ** 16): :param overwrite: If True, replace existing files. (default: False) :param chunk_size: Bytes to read at a time. (default: 64kb) """ + if isinstance(destination, Path): + destination = str(destination) if isinstance(destination, str): # Except file-likes here if os.path.isdir(destination): destination = os.path.join(destination, self.filename)