The addition of pathlib support to .save() from #1654 breaks the the ability to pass io.BytesIO objects to .save().
Previous behavior: Saving to an io.BytesIO object worked as expected.
Behavior in 1.0.0: An exception is thrown in fspath().
File "/app/main.py", line 310, in extract_metadata
files['metadata'].save(metadata_io)
File "/app/.venv/lib/python3.7/site-packages/werkzeug/datastructures.py", line 3061, in save
dst = fspath(dst)
TypeError: expected str, bytes or os.PathLike object, not _io.BytesIO
The text was updated successfully, but these errors were encountered:
# until https://github.com/pallets/werkzeug/issues/1733 is fixedbuf=io.BytesIO()
#request.files['photo'].save(buf)fromshutilimportcopyfileobjcopyfileobj(request.files['photo'].stream, buf, 16384)
Looks like we need to do some shuffling with the order we check the types and do the conversion, in order to continue to support file-like objects. Scheduled for 1.0.1, PRs welcome if anyone can work on a fix.
Versions
Report
The addition of pathlib support to
.save()
from #1654 breaks the the ability to passio.BytesIO
objects to.save()
.Previous behavior: Saving to an
io.BytesIO
object worked as expected.Behavior in 1.0.0: An exception is thrown in
fspath()
.The text was updated successfully, but these errors were encountered: