Bug Fix: slugifyLikeString skips sanitization due to unassigned replace() result
Los mantenedores suelen responder en 4 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 65/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- databases
Línea de trabajo
Comienza en app/lib/database/utils.ts, en slugifyLikeString, e inspecciona sus llamadas en app/lib/methods/search.ts y app/lib/methods/helpers/mergeSubscriptionsRooms.ts. Confirma cómo afecta a la generación del slug el resultado ignorado de replace() y verifica después que los caracteres especiales se saneen antes de que slugify() reciba el valor y que los puntos de llamada afectados sigan comportándose como se espera.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.4k
- Forks
- 1.5k
- Merge medio
- 5 d 16 h
- PR fusionados (30 d)
- 38
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RocketChat/Rocket.Chat.ReactNative
-
🐛 bug type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
RocketChat/Rocket.Chat.ReactNative#7982 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
Release network security config allows plain HTTP to 10.0.2.2 and localhostPosiblemente ocupada @samarkumar4355 la tomó hace 2 días. Abiertotype: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
RocketChat/Rocket.Chat.ReactNative#7941 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
[IMPROVEMENT] Remove redundant `await` on synchronous `userPreferences.getBool` in `getUsersPresence`Posiblemente ocupada @sandeepannandi la tomó hace 2 días. Abiertotype: feature
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
RocketChat/Rocket.Chat.ReactNative#7737 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
✅ tests 👷 ci type: feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
RocketChat/Rocket.Chat.ReactNative#7247 · 1 comentario ·
Los mantenedores suelen responder en 4 días
-
bug: goRoom navigates to broken RoomView after failed DM creation from searchPosiblemente ocupada @deepak0x la tomó hace 235 días. Abiertotype: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
RocketChat/Rocket.Chat.ReactNative#7098 ·
Los mantenedores suelen responder en 4 días
Todos los issues de RocketChat/Rocket.Chat.ReactNative
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
zabuton-app/meguri#875 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
iruzen-dono/workless#117 ·
Los mantenedores suelen responder en 1 día
-
area:api area:web wave wave:trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
vetro-protocol/vetro-monorepo#1321 ·
Los mantenedores suelen responder en 1 día