Skip to content

fix(updates): handle OSError and JSONDecodeError when reading update manifests in updates.py - #2822

Open
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/updates-router-manifest-reading-guard
Open

fix(updates): handle OSError and JSONDecodeError when reading update manifests in updates.py#2822
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/updates-router-manifest-reading-guard

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Problem

In ods/extensions/services/dashboard-api/routers/updates.py, _read_utf8() reads .env and version files via path.read_text(encoding="utf-8"). If non-UTF-8 characters exist in installed version files or local environment overrides, read_text() raised an uncaught UnicodeDecodeError or ValueError.

Fix

Pass errors="replace" parameter to path.read_text() inside _read_utf8() and expand exception handling to catch (OSError, UnicodeDecodeError, ValueError) in _read_current_version().

Verification

Verified syntax with python3 -m py_compile ods/extensions/services/dashboard-api/routers/updates.py. git diff --check passed cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant