Skip to content

Commit 62510f7

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fb_ficam
2 parents 256b07a + 5f3eb6a commit 62510f7

7 files changed

Lines changed: 70 additions & 82 deletions

File tree

core/src/org/labkey/core/dialect/PostgreSqlNonConformingStringHandler.java renamed to api/src/org/labkey/api/data/dialect/BackslashEscapingStringHandler.java

Lines changed: 59 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,59 @@
1-
/*
2-
* Copyright (c) 2011-2026 LabKey Corporation
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
17-
package org.labkey.core.dialect;
18-
19-
import org.apache.commons.lang3.StringUtils;
20-
import org.labkey.api.data.dialect.StandardDialectStringHandler;
21-
22-
/*
23-
* User: adam
24-
* Date: Aug 13, 2011
25-
* Time: 4:10:10 PM
26-
*/
27-
28-
// Adds support for backslash escaping in string literals
29-
public class PostgreSqlNonConformingStringHandler extends StandardDialectStringHandler
30-
{
31-
@Override
32-
public String quoteStringLiteral(String str)
33-
{
34-
return "'" + StringUtils.replace(StringUtils.replace(str, "\\", "\\\\"), "'", "''") + "'";
35-
}
36-
37-
38-
@Override
39-
protected int findEndOfStringLiteral(CharSequence sql, int current)
40-
{
41-
boolean skipNext = false;
42-
43-
while (current < sql.length())
44-
{
45-
char c = sql.charAt(current++);
46-
47-
if (skipNext)
48-
{
49-
skipNext = false;
50-
}
51-
else
52-
{
53-
if (c == '\\')
54-
{
55-
skipNext = true;
56-
continue;
57-
}
58-
else if (c == '\'')
59-
{
60-
break;
61-
}
62-
}
63-
}
64-
65-
return current;
66-
}
67-
}
1+
/*
2+
* Copyright (c) 2011-2026 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.api.data.dialect;
18+
19+
import org.apache.commons.lang3.Strings;
20+
21+
// Adds support for backslash escaping in string literals
22+
public class BackslashEscapingStringHandler extends StandardDialectStringHandler
23+
{
24+
@Override
25+
public String quoteStringLiteral(String str)
26+
{
27+
return "'" + Strings.CS.replace(Strings.CS.replace(str, "\\", "\\\\"), "'", "''") + "'";
28+
}
29+
30+
31+
@Override
32+
protected int findEndOfStringLiteral(CharSequence sql, int current)
33+
{
34+
boolean skipNext = false;
35+
36+
while (current < sql.length())
37+
{
38+
char c = sql.charAt(current++);
39+
40+
if (skipNext)
41+
{
42+
skipNext = false;
43+
}
44+
else
45+
{
46+
if (c == '\\')
47+
{
48+
skipNext = true;
49+
}
50+
else if (c == '\'')
51+
{
52+
break;
53+
}
54+
}
55+
}
56+
57+
return current;
58+
}
59+
}

api/src/org/labkey/api/data/dialect/SqlDialect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ void testDialectStringHandler()
24152415
{
24162416
// quotes backslashes etc
24172417
for (String v : Arrays.asList("", "'", "\"", "\\", "''", "\\'", "\\\\'", "'''", "><&/%\\' \"1~\\!@$&'()\"_+{}-=[],.#\u2603\u00E4\u00F6\u00FC\u00C5"))
2418-
testEquals(v, new SQLFragment("SELECT ").appendStringLiteral(v,d));
2418+
testEquals(v, new SQLFragment("SELECT ").appendStringLiteral(v, d));
24192419

24202420
// test things that look like postgres escapes
24212421
// https://www.postgresql.org/docs/15/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE

api/src/org/labkey/api/data/dialect/StandardDialectStringHandler.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.labkey.api.data.dialect;
1818

1919
import org.apache.commons.lang3.StringUtils;
20+
import org.apache.commons.lang3.Strings;
2021
import org.junit.Assert;
2122
import org.junit.Test;
2223
import org.labkey.api.data.Parameter;
@@ -28,17 +29,12 @@
2829
import java.util.LinkedList;
2930
import java.util.List;
3031

31-
/*
32-
* User: adam
33-
* Date: Aug 13, 2011
34-
* Time: 3:55:55 PM
35-
*/
3632
public class StandardDialectStringHandler implements DialectStringHandler
3733
{
3834
@Override
3935
public String quoteStringLiteral(String str)
4036
{
41-
return "'" + StringUtils.replace(str, "'", "''") + "'";
37+
return "'" + Strings.CS.replace(str, "'", "''") + "'";
4238
}
4339

4440

core/src/org/labkey/core/dialect/PostgreSql92Dialect.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.labkey.api.data.TableInfo;
3939
import org.labkey.api.data.TempTableInClauseGenerator;
4040
import org.labkey.api.data.TempTableTracker;
41+
import org.labkey.api.data.dialect.BackslashEscapingStringHandler;
4142
import org.labkey.api.data.dialect.BasePostgreSqlDialect;
4243
import org.labkey.api.data.dialect.DialectStringHandler;
4344
import org.labkey.api.data.dialect.JdbcHelper;
@@ -190,7 +191,7 @@ protected DialectStringHandler createStringHandler()
190191
if (getStandardConformingStrings())
191192
return super.createStringHandler();
192193
else
193-
return new PostgreSqlNonConformingStringHandler();
194+
return new BackslashEscapingStringHandler();
194195
}
195196

196197
/*

core/src/org/labkey/core/user/UserController.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,11 +1587,10 @@ public ModelAndView getView(UserQueryForm form, BindException errors)
15871587
if (schema == null)
15881588
throw new NotFoundException(CoreQuerySchema.NAME + " schema");
15891589

1590-
// use getTable(forWrite=true) because we hack on this TableInfo
1591-
// TODO don't hack on the TableInfo, shouldn't the schema check canSeeUserDetails() and has AdminPermission?
1592-
TableInfo table = schema.getTable(CoreQuerySchema.SITE_USERS_TABLE_NAME, null, true, true);
1590+
String tableName = isUserManager ? CoreQuerySchema.SITE_USERS_TABLE_NAME : CoreQuerySchema.USERS_TABLE_NAME;
1591+
TableInfo table = schema.getTable(tableName, null, true, true);
15931592
if (table == null)
1594-
throw new NotFoundException(CoreQuerySchema.SITE_USERS_TABLE_NAME + " table");
1593+
throw new NotFoundException(tableName + " table");
15951594
else if (table instanceof AbstractTableInfo)
15961595
{
15971596
// conditionally remove the email and groups columns only for this view

core/webapp/vis/src/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,12 +762,12 @@ boxPlot.render();
762762
// adjust the plot range to reserve space for log gutter
763763
var mainPlotRangeAdjustment = 30;
764764
if (xLogGutter) {
765-
if (scales.yLeft && Ext.isArray(scales.yLeft.range)) {
765+
if (scales.yLeft && Array.isArray(scales.yLeft.range)) {
766766
scales.yLeft.range = [scales.yLeft.range[0] + mainPlotRangeAdjustment, scales.yLeft.range[1]];
767767
}
768768
}
769769
if (yLogGutter) {
770-
if (scales.x && Ext.isArray(scales.x.range)) {
770+
if (scales.x && Array.isArray(scales.x.range)) {
771771
scales.x.range = [scales.x.range[0] - mainPlotRangeAdjustment, scales.x.range[1]];
772772
}
773773
}

query/src/org/labkey/query/view/sourceQuery.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
boolean canEdit = queryDef.canEdit(getUser());
5353
boolean canEditMetadata = queryDef.canEditMetadata(getUser());
5454
boolean canDelete = queryDef.canDelete(getUser());
55-
boolean isChatReady = canEdit && McpService.get().isAIFeaturesReady();
55+
boolean isChatReady = false && canEdit && McpService.get().isAIFeaturesReady();
5656
%>
5757
<style type="text/css">
5858

0 commit comments

Comments
 (0)