Skip to content

Commit b2522ae

Browse files
committed
Don't warn for ConfirmAction
1 parent bb52efd commit b2522ae

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

api/src/org/labkey/api/action/SpringActionController.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,8 @@ public static void checkForMutatingSql(Supplier<String> mutatingSqlSupplier)
12581258
ViewContext vc = HttpView.currentContext();
12591259
boolean readonly = false;
12601260

1261+
// Action classes listed below have a single code path that responds to GET and POST, so check for mutating SQL
1262+
// regardless of the current method
12611263
if (
12621264
ReadOnlyApiAction.class.isAssignableFrom(actionClass) ||
12631265
SimpleAction.class.isAssignableFrom(actionClass) ||
@@ -1272,19 +1274,24 @@ public static void checkForMutatingSql(Supplier<String> mutatingSqlSupplier)
12721274
if (null != vc && "GET".equals(vc.getRequest().getMethod()))
12731275
{
12741276
readonly = true;
1275-
if (!FormViewAction.class.isAssignableFrom(actionClass) && AppProps.getInstance().isDevMode())
1277+
// Action classes listed below have different code paths for GET vs. POST. Treat them as read-only when
1278+
// current method is GET.
1279+
if (AppProps.getInstance().isDevMode() && !(
1280+
ConfirmAction.class.isAssignableFrom(actionClass) ||
1281+
FormViewAction.class.isAssignableFrom(actionClass)
1282+
))
12761283
_log.warn("Action {} accepted GET unexpectedly... might need to update checkForMutatingSql()", actionClass.getName());
12771284
}
12781285
}
12791286

12801287
if (readonly)
12811288
{
1282-
// Note: This defers the mutating SQL parsing & detection until after the quick checks above
1289+
// Supplier allows the quick checks above us to short-circuit the mutating SQL parsing & detection work
12831290
String mutatingSql = mutatingSqlSupplier.get();
12841291
if (mutatingSql != null)
12851292
{
12861293
// Checking late in the game to ensure OptionalFeatureService has been initialized and to avoid
1287-
// reentrancy when querying this optional feature when it's not already cached.
1294+
// reentrancy when querying this optional feature flag's value when it's not already cached.
12881295
if (OptionalFeatureService.get().isFeatureEnabled(ALLOW_MUTATING_SQL_VIA_GET))
12891296
return;
12901297

0 commit comments

Comments
 (0)