浏览代码

fix(service): 放宽表名校验正则,允许数字开头和连字符

mqy20260511
humanleft 2 周前
父节点
当前提交
5c88b90a61
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      iot-platform/src/main/java/com/iot/platform/service/TdEngineService.java

+ 2
- 2
iot-platform/src/main/java/com/iot/platform/service/TdEngineService.java 查看文件

@@ -35,8 +35,8 @@ public class TdEngineService {
35 35
     // 允许的列名字符(仅 ASCII 字母、数字、下划线)
36 36
     private static final String ALLOWED_COLUMNS = "^[a-zA-Z_][a-zA-Z0-9_]*$";
37 37
 
38
-    // 允许的表名/数据库名字符
39
-    private static final String ALLOWED_TABLE_NAME = "^[a-zA-Z_][a-zA-Z0-9_]*$";
38
+    // 允许的表名/数据库名字符(允许数字开头和连字符,如 UUID 格式的表名)
39
+    private static final String ALLOWED_TABLE_NAME = "^[a-zA-Z0-9][a-zA-Z0-9_-]*$";
40 40
 
41 41
     // TdEngine 超级表最大列数限制
42 42
     private static final int MAX_COLUMNS_PER_STABLE = 4096;

正在加载...
取消
保存