Skip to content

fix(dashboard-api): handle UnicodeDecodeError in _read_env_map_from_path in settings.py - #2612

Open
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/dashboard-api-settings-unicode-decode
Open

fix(dashboard-api): handle UnicodeDecodeError in _read_env_map_from_path in settings.py#2612
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/dashboard-api-settings-unicode-decode

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Problem

In ods/extensions/services/dashboard-api/settings.py, _read_env_map_from_path() reads environment settings from .env files using path.read_text(encoding="utf-8"). If the .env file contains invalid non-UTF-8 characters or corrupt bytes, a UnicodeDecodeError previously crashed key parsing.

Fix

Pass errors="replace" to path.read_text() inside _read_env_map_from_path().

Verification

Ran pytest ods/extensions/services/dashboard-api/tests/test_routers.py (54/54 passed). 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