Skip to content

fix: report unsupported backslashes in field keys - #737

Open
2836048681 wants to merge 1 commit into
influxdata:masterfrom
2836048681:fix/660-field-key-backslash-space
Open

2836048681 wants to merge 1 commit into
influxdata:masterfrom
2836048681:fix/660-field-key-backslash-space

Conversation

@2836048681

Copy link
Copy Markdown

Closes #660.

Proposed changes

When a field key contains an odd number of backslashes immediately before a space, escaping the space adds one more backslash. InfluxDB consumes the resulting backslashes in pairs and reads the space as a delimiter. A write then fails with HTTP 400 and an invalid field format error.

Raise a ValueError from Point.to_line_protocol() that names the field key and explains the unsupported sequence. Point and dictionary writes get the same validation through the serializer. The check runs only for fields that will be included in the output.

Validation

  • All 49 point tests and seven subtests passed. The four new rejection subtests failed on the original code.
  • On local InfluxDB 2.7.6, the original payload returned HTTP 400. The patched synchronous writer raised ValueError before issuing a request, and valid field keys round-tripped with their names intact.
  • Flake8 passed for the changed module. The full lint command reported two E721 violations in generated API clients, both reproduced on the original code. Git diff checks passed.
  • Full suite on Python 3.12 against local InfluxDB 2.7.6 reported 420 passed, 3 skipped, including 15 passing subtests. The test log is screening/pytest-fixed-full-workspace.log in the round workspace.

Checklist

  • CHANGELOG.md updated
  • Regression tests added
  • Conventional commit message
  • Full test suite passes
  • CLA signed by submitter, if required

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.

Exception from backslash followed by space in field key

1 participant