Repository navigation
fix(tasks): escape task name and cron in generated Flux task option - #741
Merged
karel-rehor merged 2 commits intoDec 4, 2026
Merged
Conversation
create_task_every and create_task_cron inserted the task name and cron
expression into the Flux `option task` record without escaping, so a
backslash, double quote or `${` produced invalid Flux or an unintended
string interpolation.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #741 +/- ##
==========================================
- Coverage 90.83% 90.79% -0.05%
==========================================
Files 41 41
Lines 3591 3595 +4
==========================================
+ Hits 3262 3264 +2
- Misses 329 331 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
karel-rehor
approved these changes
Dec 4, 2026
karel-rehor
left a comment
Contributor
There was a problem hiding this comment.
@pcbeingused33 Thank you for this contribution.
It appears to mirror the go PR452 precisely.
Looks good to me. 🚴 🏁
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Escapes the task name and cron that
TasksApi.create_task_every/create_task_cronput into the generated Fluxoption task(the same fix was merged in influxdata/influxdb-client-go#452).Proposed Changes
TasksApi._create_taskbuilds the Flux script asby plain string formatting. A task name containing
"or\produces invalid Flux (the task is rejected by the server), and a name containing${...}is evaluated as Flux string interpolation instead of being kept literally.This adds a small
_escape_flux_stringhelper that escapes\,"and${(the escapes defined for Flux string literals) and applies it to the name and the cron expression.everyis a duration literal, not a string, so it is left unchanged. Names without those characters produce exactly the same Flux as before.Tests: new unit tests in
tests/test_TasksApi.py(TasksApiFluxOptionTest) check the generatedoption taskfor a name with",\and${x}, and for a cron with". They fail onmasterand pass with this change; they don't need an InfluxDB server.Checklist
This change was prepared with the help of an AI coding assistant.