Restore support for using pathlib.Path for static_folder.

* No longer causes AttributeError: 'PosixPath' object has no
  attribute 'rstrip'.

* This was broken by e6178fe489
  which was released in 1.1.2.

* Add a regression test that now passes.

See #3557.
This commit is contained in:
Joshua Bronson 2020-04-20 13:26:33 -04:00
parent b82cca7283
commit 7ba35c4d4f
3 changed files with 20 additions and 1 deletions

View file

@ -980,7 +980,7 @@ class _PackageBoundObject:
@static_folder.setter
def static_folder(self, value):
if value is not None:
value = value.rstrip("/\\")
value = os.fspath(value).rstrip(r"\/")
self._static_folder = value
@property