andrewleech / PyWebDAV3

Port of PyWebDAV to python3, originally from http://code.google.com/p/pywebdav/
72 stars 34 forks source link

Putting binary data could cause UnicodeDecodeError #9

Closed sakurai-youhei closed 6 years ago

sakurai-youhei commented 6 years ago

https://github.com/andrewleech/PyWebDAV3/blob/4ad90df8d9fc9ab45f6092959fd4f88e74092f92/pywebdav/server/fshandler.py#L273

Data should be written without decoding like fp.write(data); Of course, the file should be opened with b option like fp=open(path, "bw+") beforehand.

Btw, catching Exception could give better debugging capability.

        except Exception as e:
            log.info('put: Could not create %s, %r', uri, e)
            raise DAV_Error(424)