From 441009471e3f5adc0496f2c9456a50b959f0dd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Thierry=20K=C3=A9chichian?= Date: Fri, 13 Oct 2023 02:10:16 +0200 Subject: [PATCH] NRE in query editor (#14501) --- .../OrchardCore.Queries/Sql/Controllers/AdminController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs index b107070c3b4..4c1cfe9d7dd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Controllers/AdminController.cs @@ -55,6 +55,8 @@ public Task Query(string query) [HttpPost] public async Task Query(AdminQueryViewModel model) { + model.FactoryName = _store.Configuration.ConnectionFactory.GetType().FullName; + if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageSqlQueries)) { return Forbid(); @@ -80,8 +82,6 @@ public async Task Query(AdminQueryViewModel model) var tokenizedQuery = await _liquidTemplateManager.RenderStringAsync(model.DecodedQuery, NullEncoder.Default, parameters.Select(x => new KeyValuePair(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;