Skip to content

Commit

Permalink
fix(editor-element): OPtimized handling of non editbale files through…
Browse files Browse the repository at this point in the history
… backend and updated file uploaded for proper build
  • Loading branch information
priyakanabar-crest committed Nov 25, 2024
1 parent 81d1687 commit cde9623
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 234 deletions.
6 changes: 6 additions & 0 deletions zt_backend/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,12 @@ def read_file(path: str):
with open(path, 'r', encoding='utf-8') as file:
content = file.read()
return {"content": content}

except UnicodeDecodeError:
raise HTTPException(
status_code=400,
detail="The type of file you are trying to edit cannot be edited. Please ensure you edit a compatible file."
)
except FileNotFoundError:
raise HTTPException(status_code=404, detail="File not found")
except Exception as e:
Expand Down
Loading

0 comments on commit cde9623

Please sign in to comment.