influxdata / influxdata/ui

Query Builder doesn't escape quotes in tag values

Open
#5,323 0 comments 0 reactions 0 assignees View on GitHub
kind/bug team/automation team/ui
Dominant language
TypeScript
Stars
117
Forks
51
Avg merge
2d 15h
Merged PRs (30d)
4

Description

## About the bug

When writing data in, double quotes (`"`) are legal within tag values, but are just treated as any other character, so if tag value `foo` is mistakenly quoted the value of the tag in the db will be `"foo"`

However, when using the query builder to query data out, these quotes will not be escaped in the underlying flux (example is OSS v2.3, but has been check in InfluxDB Cloud too)

![Screenshot_20220807_190647](https://user-images.githubusercontent.com/88340935/183442408-e552f2a1-d4fe-4e18-b24c-a59e07ffd03c.png)

If the quotes are escaped:
```
from(bucket: "websites/analytics")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "pf_analytics")
|> filter(fn: (r) => r["page"] == "\"/page-1905091439-Battered-Mars-Bar-Snacks.html\"")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")

```
Then the query works.

It's definitely an edge case, but would be nice if it worked without needing to edit the underlying Flux.

**Steps to reproduce:**
List the minimal actions needed to reproduce the behavior.

1. Write in data with at least one double quote in a tag value
2. Use the query builder to create a query which filters by that tag

**Expected behavior:**

The query should run

**Actual behavior:**

An error is returned because the quotes haven't been escaped.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.