Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

feat: wildcard search file name in direct,group,channel and filter by typeGroup

Open zscontributor opened this issue 7 months ago • 2 comments

Proposed changes (including videos or screenshots)

Before the upgrade:

  • Searching for file names in groups and direct messages did not work correctly.
  • Searching for file names in channels did not support Unicode languages.
  • Searching by file extension was not supported.

before mov

After the upgrade:

  • File names can now be searched using Unicode characters, including Japanese, Korean, Vietnamese, etc.
  • Supports wildcard search and searching by file extension.

after mov

Issue(s)

https://github.com/RocketChat/feature-requests/issues/953

Steps to test or reproduce

Further comments

zscontributor avatar Jun 05 '25 15:06 zscontributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

dionisio-bot[bot] avatar Jun 05 '25 15:06 dionisio-bot[bot]

🦋 Changeset detected

Latest commit: 5163822942523801eb166ad79c87893fa665ef0c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Major
@rocket.chat/core-typings Major
@rocket.chat/rest-typings Major
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Major
@rocket.chat/ui-voip Major
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 05 '25 15:06 changeset-bot[bot]

Walkthrough

Adds Unicode-aware wildcard name filtering to files listing across channels, groups, and direct messages. Introduces a wildcard-to-regex utility, updates query construction and parameter normalization, and adjusts REST typings to include optional name/typeGroup and configurable additionalProperties in group base props.

Changes

Cohort / File(s) Summary
API routes: files listing (channels, groups, IM)
apps/meteor/app/api/server/v1/channels.ts, apps/meteor/app/api/server/v1/groups.ts, apps/meteor/app/api/server/v1/im.ts
Added wildcard-based name filtering via wildcardToRegex with iu regex flags; normalized/decoded query params; safer type checks; consolidated query objects; minor control-flow adjustments for access checks and room resolution.
String utilities
apps/meteor/lib/utils/stringUtils.ts
New export wildcardToRegex(pattern: string) converting */? wildcards to an anchored regex string.
REST typings (groups)
packages/rest-typings/src/v1/groups/BaseProps.ts
Updated withGroupBaseProperties signature to accept additionalProperties; added optional name and typeGroup to both schema branches; propagate additionalProperties.
Changeset metadata
.changeset/grumpy-donuts-whisper.md
Notes Unicode support for filename search and wildcard handling; no public API changes besides internal behaviors.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API as REST API (channels/groups/im .files)
  participant Rooms as Room Resolver
  participant Auth as Access Check
  participant Util as wildcardToRegex
  participant DB as Uploads Store

  Client->>API: GET *.files?roomId|roomName&name=pattern
  API->>Rooms: Resolve room by id/name
  Rooms-->>API: Room or error
  API->>Auth: canAccess(user, room)
  Auth-->>API: allowed/denied
  alt denied
    API-->>Client: 403
  else allowed
    API->>API: Normalize/decode query params
    alt name has * or ?
      API->>Util: wildcardToRegex(pattern)
      Util-->>API: ^regex$
      API->>API: Build query with /regex/iu
    else literal name
      API->>API: Build query with exact/partial match
    end
    API->>DB: findPaginatedWithoutThumbs(query, sort, paging)
    DB-->>API: files page
    API-->>Client: 200 files list
  end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

stat: QA assured

Suggested reviewers

  • abhinavkrin
  • tassoevan

Poem

A bunny hops through names so wide,
From 星 to файл, it scans with pride.
With wildcards twinkling, iu in tow,
It sniffs out files where bytes may flow.
Regex whiskers twitch—what a sight!
Unicode burrows, found just right. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title accurately summarizes the main change: enabling wildcard file-name search across direct, group, and channel contexts and adding filtering by typeGroup, which matches the code changes (wildcardToRegex, updated channel/group/IM routes, and schema updates). It is concise and directly related to the changeset, though the punctuation/spacing could be cleaned for readability.
✨ Finishing touches
  • [ ] 📝 Generate Docstrings
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

[!TIP]

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 23 '25 02:09 coderabbitai[bot]