Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pgcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ def parse_service_info(service):
with open(service_file, newline="") as f:
skipped_lines = skip_initial_comment(f)
try:
service_file_config = ConfigObj(f)
service_file_config = ConfigObj(f, comment_tokens=[])
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s test coverage for service-file parsing (test_pg_service_file), but it doesn’t cover the regression fixed here (passwords containing #). Please extend/add a test case with password=abc#123 (and ideally one with a trailing comment after the value) to ensure the password is preserved and comment handling remains correct.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting comment_tokens=[] disables all #/; comment parsing for the entire .pg_service.conf. That will likely break valid service files that contain full-line comments after the first section header (those # ... lines would no longer be treated as comments and can trigger a parse error). Consider using a parser/configuration that keeps full-line comments but disables inline comment parsing (e.g., a ConfigParser setup with inline_comment_prefixes=() while retaining comment_prefixes, or another ConfigObj option that only disables inline comments).

Copilot uses AI. Check for mistakes.
except ParseError as err:
err.line_number += skipped_lines
raise err
Expand Down
Loading