mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00
fix variable escaping
This commit is contained in:
@ -48,7 +48,11 @@ export default class PostgresQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
quoteLiteral(value) {
|
quoteLiteral(value) {
|
||||||
return "'" + value.replace("'", "''") + "'";
|
return "'" + this.escapeLiteral(value) + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
escapeLiteral(value) {
|
||||||
|
return value.replace("'", "''");
|
||||||
}
|
}
|
||||||
|
|
||||||
hasTimeGroup() {
|
hasTimeGroup() {
|
||||||
@ -62,7 +66,7 @@ export default class PostgresQuery {
|
|||||||
interpolateQueryStr(value, variable, defaultFormatFn) {
|
interpolateQueryStr(value, variable, defaultFormatFn) {
|
||||||
// if no multi or include all do not regexEscape
|
// if no multi or include all do not regexEscape
|
||||||
if (!variable.multi && !variable.includeAll) {
|
if (!variable.multi && !variable.includeAll) {
|
||||||
return value;
|
return this.escapeLiteral(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
|
Reference in New Issue
Block a user