diff --git a/labelu/internal/application/service/pre_annotation.py b/labelu/internal/application/service/pre_annotation.py index 26783b19..1e766e6f 100644 --- a/labelu/internal/application/service/pre_annotation.py +++ b/labelu/internal/application/service/pre_annotation.py @@ -25,10 +25,14 @@ def read_jsonl_file(db: Session, file_id: int) -> List[dict]: attachment = crud_attachment.get(db, file_id) if attachment is None: - raise LabelUException(status_code=404, code=ErrorCode.CODE_51001_TASK_ATTACHMENT_NOT_FOUND) + return [] attachment_path = attachment.path file_full_path = settings.MEDIA_ROOT.joinpath(attachment_path.lstrip("/")) + + # check if the file exists + if not file_full_path.exists() or not attachment.filename.endswith('.jsonl'): + return [] try: with open(file_full_path, "r", encoding="utf-8") as f: diff --git a/pyproject.toml b/pyproject.toml index 2bedaf7c..ff3e356f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "labelu" -version = '1.0.6' +version = '1.0.7-alpha.1' description = "" license = "Apache-2.0" authors = ["shenguanlin "]