We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
对于现版本typora,其文件路径中中文汉字会被url编码,导致无法上传图片。 由此建议将文件上传接口中的图片路径进行url解码
from urllib.parse import unquote
async def upload_img(path): """上传图片""" path = unquote(path, 'utf-8') # 此处添加url解码 name = os.path.basename(path) _, suffix = os.path.splitext(name) print(f"正在上传{name}") with open(path, 'rb') as f: file = { "bits": f.read(), "name": name, "type": mime_mapping[suffix] } url = server.metaWeblog.newMediaObject(conf["blog_id"], conf["username"], conf["password"], file) return url
The text was updated successfully, but these errors were encountered:
@pikpiksec 欢迎提pr
Sorry, something went wrong.
No branches or pull requests
对于现版本typora,其文件路径中中文汉字会被url编码,导致无法上传图片。
由此建议将文件上传接口中的图片路径进行url解码
from urllib.parse import unquote
async def upload_img(path):
"""上传图片"""
path = unquote(path, 'utf-8') # 此处添加url解码
name = os.path.basename(path)
_, suffix = os.path.splitext(name)
print(f"正在上传{name}")
with open(path, 'rb') as f:
file = {
"bits": f.read(),
"name": name,
"type": mime_mapping[suffix]
}
url = server.metaWeblog.newMediaObject(conf["blog_id"], conf["username"], conf["password"], file)
return url
The text was updated successfully, but these errors were encountered: