Seafile API 不会不支持中文文件名上传吧?
- seafile-server-7.0.5 ubunut Nginx代理
- seafile_api-0.1.2 client python api, Pip 安装
- Python 3.7.3
调用
SeafDir.upload_local_file(filename) 其中文件名为中文会导致如下错误
seafileapi.exceptions.ClientHttpError: ClientHttpError[400: Expected 200, but get 400]
Uncaught exception. Entering post mortem debugging
设定pdb.trace() debug在
-------------------------------------------------------预格式化文本
def upload(self, fileobj, filename):
“”"Upload a file to this folder.:param:fileobj :class:`File` like object :param:filename The name of the file Return a :class:`SeafFile` object of the newly uploaded file. """ if isinstance(fileobj, str): fileobj = io.BytesIO(fileobj) upload_url = self._get_upload_link() pdb.set_trace() files = {
> ‘file’: (filename, fileobj), <—如果这里filename是中文文件名,则失败,英文的没问题
'parent_dir': self.path, } self.client.post(upload_url, files=files) return self.repo.get_file(posixpath.join(self.path, filename))