Skip to content

Commit f502b5d

Browse files
committed
XWIKI-23093: Improve deleted documents query
* fix typo * move the check after the very last modification to the string to validate (cherry picked from commit dfd0744)
1 parent cf6c843 commit f502b5d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/DefaultHQLStatementValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void checkOrderBySafe(List<String> allowedPrefixes, String orderByValue)
117117
}
118118

119119
if (!valid) {
120-
throw new QueryException("Usafe ORDER BY value [" + orderByValue + "].", null);
120+
throw new QueryException("Unsafe ORDER BY value [" + orderByValue + "].", null);
121121
}
122122
}
123123
}

xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/getdeleteddocuments.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ $response.setContentType("application/json")
4949
#set ($order = "$!request.sort")
5050
#set ($orderQueryPart = '')
5151
#if ($order != '')
52-
#set($discard = $services.query.hql.checkOrderBySafe(['ddoc.'], $order))
5352
#set ($orderDirection = "$!{request.get('dir').toLowerCase()}")
5453
#if ("$!orderDirection" != '' && "$!orderDirection" != 'asc')
5554
#set($orderDirection = 'desc')
@@ -59,6 +58,7 @@ $response.setContentType("application/json")
5958
## So we filter on the document full name instead, which is the expected behavior.
6059
#set ($order = 'ddoc.fullName')
6160
#end
61+
#set($discard = $services.query.hql.checkOrderBySafe(['ddoc.'], $order))
6262
## Weird things happen if we use "ORDER BY" (upper case), at least on HSQLDB. Other DBs may behave differently
6363
#set ($orderQueryPart = "order by ${order} ${orderDirection}")
6464
#end

0 commit comments

Comments
 (0)