[Bug]: Page image uploads succeed, but original and thumbnail return 404 Attachment was not found
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
- Nửa ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Start in internal/repository/attachment_repository.go, where the item download and thumbnail lookups join items and restrict entity_type, so page-scoped rows never match. Compare with internal/services/page_attachment_upload_service.go, which writes EntityType "page", and internal/services/item_attachment_service.go, which OpenItemAttachment calls. Done when a page image's content and thumbnail return 200 for authorised users while unauthorised and unrelated requests still get 404.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Page image uploads persist both the original image and its thumbnail, but opening the resulting attachment through the shared attachment binary URLs returns 404 with {"error":{"code":"not_found","message":"Attachment was not found"}}.
This appears to be a mismatch between page-scoped upload metadata and item-only retrieval. The existing binary endpoints call OpenItemAttachment, which intentionally excludes attachment rows where entity_type='page'.
Environment
- Windshift: self-hosted Linux binary; deployment derived from v0.8.9 with a local SMTP patch. The code paths described were also inspected in the main branch (28 October 2026).
- AWS EC2, systemd and Nginx reverse proxy.
- Filesystem storage enabled with
--attachment-path /var/lib/windshift/attachments. - Uploading a JPEG to a page created both a .jpeg and .thumb.jpg under attachments/pages/5/.
Steps to reproduce
- Start Windshift with a writable --attachment-path.
- As an authorised user, open a workspace page and upload/insert a JPEG image.
- Confirm the upload succeeds and the image and thumbnail exist under the storage root.
- Open the embedded image in a new tab (or request the generated /attachments/{id}/content or /thumbnail URL).
- Observe a 404 JSON error: Attachment was not found.
Expected
An authorised user with permission to view the owning page can retrieve the original and thumbnail inline. Unauthorised users, or requests for unrelated/nonexistent attachments, continue to receive 404. Existing work-item attachments remain unaffected.
Actual
The upload writes the files, but the binary response returns 404 not_found.
Root-cause analysis
- internal/services/page_attachment_upload_service.go: UploadPageAttachment records EntityType: "page", ItemID: in.PageID and stores files in a pages// directory.
- internal/restapi/v2/attachments.go: the shared /attachments/{attachment_id}/content, /download and /thumbnail routes use serveItemAttachment, calling OpenItemAttachment.
- internal/services/item_attachment_service.go: OpenItemAttachment calls GetItemDownloadRecord / GetItemThumbnailRecord.
- internal/repository/attachment_repository.go: both item record lookups JOIN items and explicitly restrict entity_type to item-like values. A page-scoped row can therefore never match. The resulting ErrItemAttachmentNotFound maps to the observed JSON 404.
- Ngôn ngữ chính
- Go
- Star
- 421
- Fork
- 50
- Merge trung bình
- 17 giờ 34 phút
- Pull request đã merge (30 ngày)
- 80
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Windshiftapp/core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Windshiftapp/core#542 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Time Tracking FilteringĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Windshiftapp/core#334 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Windshiftapp/core#259 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug][AI chat] Select menu dont appear when on index pageCó thể đã có người làm @valentimarco đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
Windshiftapp/core#541 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Windshiftapp/core#538 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Windshiftapp/core
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
karmada-io/karmada#8101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
product:platform
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Infisical/infisical#9746 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CrossEntropyFilter raises on zero probabilities and single-class resultsCó thể đã có người làm @NopeCharon đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
txn2/mcp-data-platform#2728 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort:s impact:low raised-by:worker risk:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
medici-finance/assay#7259 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày