[Bug]: Unified search returns HTTP 500 for the Files provider when "is-favorite" or "title-only" is set

Đang mở
#67,051 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend, search

Hướng nghiên cứu

Read apps/files/lib/Search/FilesSearchProvider.php, especially getSupportedFilters(), getCustomFilters(), and buildSearchQuery(). Reproduce the requests with is-favorite=1 and title-only=1, then inspect the related search tests. Done means both filters either work as advertised or are no longer advertised, and neither request returns HTTP 500.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

1. to develop 36-feedback bug feature: search
Bug description

The Files search provider lists is-favorite and title-only as supported filters (FilesSearchProvider::getSupportedFilters(), and is-favorite is also declared in getCustomFilters()), but buildSearchQuery() has no branch for either of them. A search that sets one of them fails with InvalidArgumentException: Unsupported comparison and the OCS endpoint answers HTTP 500.

Steps to reproduce
  1. Log in as any user (basic auth works for the OCS API).
  2. GET /ocs/v2.php/search/providers/files/search?term=report returns 200 with the results.
  3. GET /ocs/v2.php/search/providers/files/search?term=report&is-favorite=1 returns HTTP 500, statuscode 996 "Internal Server Error".
  4. GET /ocs/v2.php/search/providers/files/search?term=report&title-only=1 returns the same HTTP 500.
  5. nextcloud.log has InvalidArgumentException: Unsupported comparison for both requests.
Expected behavior

The filters the provider says it supports should either narrow the search (favorites only; name only, which is what the Files search already does) or be removed from the supported list, so the request does not fail with a 500.

Nextcloud Server version

master (36.0.0 dev, checked at 24e0f84c71d3)

Operating system

Debian-based Docker image (chialab/php:8.3)

PHP engine version

PHP 8.3 (8.3.36)

Web server

Other (PHP built-in server, php -S)

Database engine version

SQLite

Is this bug present after an update or on a fresh install?

Fresh install

Are you using the Nextcloud Server Encryption module?

No

What user-backends are you using?

Default user-backend (database)

Configuration report

Not needed, fresh test instance with default config.

List of activated Apps

Default apps enabled with tests/enable_all.php.

Nextcloud Signing status

Not applicable (development checkout).

Nextcloud Logs
{"Exception":"InvalidArgumentException","Message":"Unsupported comparison", ...}

Raised from apps/files/lib/Search/FilesSearchProvider.php, buildSearchQuery(), for the two requests above.

Additional info

Reproduced on a fresh install of current master. I did not check stable branches.

Assisted by ClaudeCode

Ngôn ngữ chính
PHP
Star
37.6k
Fork
5.4k
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
623

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nextcloud/server

Tất cả issue của nextcloud/server

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.