Bug Fix: slugifyLikeString skips sanitization due to unassigned replace() result
维护者通常 4 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- databases
调研方向
从 app/lib/database/utils.ts 中的 slugifyLikeString 开始,并检查 app/lib/methods/search.ts 和 app/lib/methods/helpers/mergeSubscriptionsRooms.ts 中对它的调用方。确认被忽略的 replace() 结果如何影响 slug 化,然后验证在 slugify() 接收该值之前特殊字符已被清理,并且受影响的调用点仍按预期运行。
由索引模型根据 Issue 内容生成。
描述
Describe the Bug
The function slugifyLikeString in app/lib/database/utils.ts (around line 14) contains a bug where the replace() result is not assigned or returned.
Because of this, the string sanitization step is effectively skipped, and the unsanitized string (which may contain special characters) is passed directly to slugify().
Steps to Reproduce
Open app/lib/database/utils.ts.
Locate the slugifyLikeString function (lines 12–17).
Notice this line:
str?.replace(likeStringRegex, '_');
The result of replace() is not assigned back to str or returned.
This means the sanitization step does not take effect before the string is passed to slugify().
Expected Behavior
The line should assign the result of replace() back to the variable:
str = str?.replace(likeStringRegex, '_') ?? str;
OR
chain the operation like this:
const sanitized = str.replace(likeStringRegex, '_');
const slugified = slugify(sanitized);
return slugified;
The string should always be sanitized before being passed to slugify().
Actual Behavior
The replace() on line 14 does nothing because its result is ignored.
The raw string with special characters is passed directly to slugify().
The sanitization step is effectively skipped.
Rocket.Chat Server Version
N/A (Code bug fix)
Rocket.Chat App Version
4.67.0
Device Name
N/A
OS Version
N/A
Additional Context
File: app/lib/database/utils.ts
Impact: The slugifyLikeString function is used in:
app/lib/methods/search.tsapp/lib/methods/helpers/mergeSubscriptionsRooms.ts
Note: This bug means special characters may not be properly sanitized before slugification, which could lead to unexpected behavior in search and room merging functionality.
- 主要语言
- TypeScript
- 星标
- 2.4k
- 派生
- 1.5k
- 平均合并
- 5 天 16 小时
- 30 天内合并 PR
- 38
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RocketChat/Rocket.Chat.ReactNative 的其他 Issue
-
🐛 bug type: bug
难度 2/5 1-3 小时 新手友好度 74/100
RocketChat/Rocket.Chat.ReactNative#7982 · 1 条评论 ·
维护者通常 4 天内回复
-
Release network security config allows plain HTTP to 10.0.2.2 and localhost可能已有人在做 @samarkumar4355 于 2 天前认领。 未关闭type: bug
难度 2/5 1-3 小时 新手友好度 67/100
RocketChat/Rocket.Chat.ReactNative#7941 · 2 条评论 ·
维护者通常 4 天内回复
-
[IMPROVEMENT] Remove redundant `await` on synchronous `userPreferences.getBool` in `getUsersPresence`可能已有人在做 @sandeepannandi 于 2 天前认领。 未关闭type: feature
难度 1/5 1 小时以内 新手友好度 92/100
RocketChat/Rocket.Chat.ReactNative#7737 · 1 条评论 ·
维护者通常 4 天内回复
-
✅ tests 👷 ci type: feature
难度 2/5 1-3 小时 新手友好度 65/100
RocketChat/Rocket.Chat.ReactNative#7247 · 1 条评论 ·
维护者通常 4 天内回复
-
bug: goRoom navigates to broken RoomView after failed DM creation from search可能已有人在做 @deepak0x 于 235 天前认领。 未关闭type: bug
难度 2/5 1-3 小时 新手友好度 78/100
RocketChat/Rocket.Chat.ReactNative#7098 ·
维护者通常 4 天内回复
查看 RocketChat/Rocket.Chat.ReactNative 的全部 Issue
相似的 Issue
-
agent/guide documentation help wanted stage/010-actionable
难度 1/5 1 小时以内 新手友好度 82/100
kubestellar/console-marketplace#1101 ·
维护者通常 1 天内回复
-
Java Edition Tests
难度 2/5 1-3 小时 新手友好度 72/100
JSPrismarine/JSPrismarine#4178 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
totec448-spec/chat-on-steroids#2394 ·
维护者通常 1 天内回复
-
github_actions
难度 2/5 1-3 小时 新手友好度 70/100
StellarHyperion/stellarhyperion-backend#499 ·
维护者通常 1 天内回复