SharesUpdatedListener doesn't restore the home setup listener state on errors

Đang mở Phù hợp với người mới
#67,590 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend, testing

Hướng nghiên cứu

Đọc apps/files_sharing/lib/Listener/SharesUpdatedListener.php, đặc biệt là các thay đổi trạng thái của listener quanh dòng 71 và 137, rồi kiểm tra bài kiểm thử bao quát SharesUpdatedListener. Kiểm tra trạng thái hoạt động thế nào khi callback ném ra ngoại lệ, sau đó chạy bài kiểm thử liên quan. Hoàn tất khi trạng thái UserHomeSetupListener trước đó được khôi phục sau lỗi và bài kiểm thử bao quát trường hợp này.

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

Mô tả

1. to develop bug feature: sharing
Bug description

SharesUpdatedListener::handle() disables the UserHomeSetupListener while it updates shares and restores the old state at the end:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/apps/files_sharing/lib/Listener/SharesUpdatedListener.php#L71
https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/apps/files_sharing/lib/Listener/SharesUpdatedListener.php#L137

The restore is not in a finally, so if one of the callbacks throws (as in #67014), the home setup listener stays disabled for the rest of the request and pending share refreshes aren't run on later home folder setups in that request.

Steps to reproduce

Found by code reading.

  1. Trigger a share update (e.g. add a user to a group with shares) where a share target validation listener throws.
  2. Later file system setups in the same request skip the share refresh.
Expected behavior

The old state is restored in a finally block, covered by a test.

Nextcloud version

master

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

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.