fix: 修复无法正确获取文件后缀名的问题

This commit is contained in:
han0
2023-03-22 10:15:29 +08:00
parent edd6ea8dc7
commit 5a552f02ea

View File

@@ -22,7 +22,7 @@ def save_file(f: FileStorage, path: str, namespace: str = None, filename: str =
if not os.path.exists(save_path):
os.makedirs(save_path)
filename = filename or '{}{}'.format(str(int(time.time() * 1000)), os.path.splitext(f.name)[-1])
filename = filename or '{}{}'.format(str(int(time.time() * 1000)), os.path.splitext(f.filename)[-1])
file_path = os.path.join(save_path, filename)
with open(file_path, 'wb+') as tmp_f:
tmp_f.write(f.read())