Skip to content

Commit

Permalink
NRE in query editor (#14501)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtkech authored Oct 13, 2023
1 parent 600d214 commit 4410094
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public Task<IActionResult> Query(string query)
[HttpPost]
public async Task<IActionResult> Query(AdminQueryViewModel model)
{
model.FactoryName = _store.Configuration.ConnectionFactory.GetType().FullName;

if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageSqlQueries))
{
return Forbid();
Expand All @@ -80,8 +82,6 @@ public async Task<IActionResult> Query(AdminQueryViewModel model)

var tokenizedQuery = await _liquidTemplateManager.RenderStringAsync(model.DecodedQuery, NullEncoder.Default, parameters.Select(x => new KeyValuePair<string, FluidValue>(x.Key, FluidValue.Create(x.Value, _templateOptions))));

model.FactoryName = _store.Configuration.ConnectionFactory.GetType().FullName;

if (SqlParser.TryParse(tokenizedQuery, _store.Configuration.Schema, dialect, _store.Configuration.TablePrefix, parameters, out var rawQuery, out var messages))
{
model.RawSql = rawQuery;
Expand Down

0 comments on commit 4410094

Please sign in to comment.