Skip to content

Commit

Permalink
fix local file problem
Browse files Browse the repository at this point in the history
  • Loading branch information
MorvanZhou committed Nov 8, 2023
1 parent fb14df1 commit 87784be
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/rethink/models/files/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ def __set_running_false(uid: str, code: const.Code, problem_files: List[str] = N

def upload_obsidian_thread(
uid: str,
zipped_file: UploadFile,
bytes_data: bytes,
filename: str,
doc: dict,
max_file_size: int,
) -> None:
try:
unzipped_files = unzip_file(zipped_file.file.read())
unzipped_files = unzip_file(bytes_data)
except zipfile.BadZipFile:
__set_running_false(uid, const.Code.INVALID_FILE_TYPE, [zipped_file.filename])
__set_running_false(uid, const.Code.INVALID_FILE_TYPE, [filename])
return
filtered_files = {}
existed_filename2nid = doc["obsidian"].copy()
Expand Down Expand Up @@ -240,7 +241,7 @@ def upload_obsidian(uid: str, zipped_files: List[UploadFile]) -> const.Code:

td = threading.Thread(
target=upload_obsidian_thread,
args=(uid, zipped_file, doc, max_file_size),
args=(uid, zipped_file.file.read(), zipped_file.filename, doc, max_file_size),
daemon=True,
)
td.start()
Expand Down

0 comments on commit 87784be

Please sign in to comment.