Deleting/updating file attachments fails with 404 — frontend calls singular attachment/{type}:{id} but OCS route is plural attachments/{id}
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
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, php
Hướng nghiên cứu
Bắt đầu với src/services/attachment.js và so sánh deleteAttachment(), updateAttachment() và restoreAttachment() với các route OCS trong appinfo/routes.php và AttachmentOcsController. Xác minh đường dẫn và các tham số của request dựa trên lời gọi DELETE đã được xác nhận là hoạt động, sau đó thực hiện việc xóa, cập nhật và khôi phục một tệp đính kèm để xác nhận cả ba thao tác đều thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Removing a file attachment (a file shared from Files, type: file) from a card via the sidebar (⋯ → Remove attachment) does nothing. The DELETE request returns HTTP 404 / OCS statuscode: 998 ("Invalid query"). The same mismatch affects updating and restoring attachments.
Steps to reproduce
Add a file to a card via "Share from Files" (creates a share_type 12 attachment).
Open the card, ⋯ on the attachment → Remove attachment.
Nothing happens; the Network tab shows a failed DELETE.
Actual request (fails):
DELETE /ocs/v2.php/apps/deck/api/v1.0/cards/52/attachment/file:198?boardId=7
→ 404, {"ocs":{"meta":{"status":"failure","statuscode":998,"message":"Invalid query, ..."}}}
Root cause
The frontend AttachmentApi builds the URL with singular attachment/ and a composite type🆔
// src/services/attachment.js (as shipped in js/deck-main.js)
async deleteAttachment(attachment, boardId) {
await axios({ method: 'DELETE',
url: this.ocsUrl(/cards/${attachment.cardId}/attachment/${attachment.type}:${attachment.id}),
params: { boardId: boardId ?? null } })
}
// updateAttachment() and restoreAttachment() use the same singular attachment/${type}:${id} scheme
But the OCS routes register delete/update/restore under plural attachments/{attachmentId} with type as a separate parameter:
// appinfo/routes.php (ocs)
['name' => 'attachment_ocs#delete', 'url' => '/api/v{apiVersion}/cards/{cardId}/attachments/{attachmentId}', 'verb' => 'DELETE'],
// AttachmentOcsController::delete(int $cardId, int $attachmentId, string $type = 'file', ?int $boardId = null)
So the singular path matches no OCS route → 998/404. (createAttachment POST /cards/{cardId}/attachment and getAll /cards/{cardId}/attachments both match fine — only delete/update/restore are inconsistent.)
Confirmed working call (proves the backend is fine, only the frontend URL is wrong):
DELETE /ocs/v2.php/apps/deck/api/v1.0/cards/52/attachments/198?type=file&boardId=7
→ 200 OK (share removed, source file kept)
Suggested fix
Align the frontend AttachmentApi delete/update/restore to /cards/${cardId}/attachments/${attachment.id} and pass type via params (matching the OCS controller). The shipped 1.18.2 JS bundle appears out of sync with the OCS routes.
Server configuration
Nextcloud: 34.0.1
Deck: 1.18.2 (files verified against the official signature.json — unmodified)
DB: MySQL · PHP 8.x · nginx (YunoHost)
Browser: Chrome 149
- Ngôn ngữ chính
- JavaScript
- Star
- 1.4k
- Fork
- 358
- Merge trung bình
- 2 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 83
Chuẩn bị môi trường
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.
- Không có Dockerfile hay tệp Docker Compose
- 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 nextcloud/deck
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
CSV export leaves trailing commas in tags and assigned-user fieldsCó thể đã có người làm @Kumar-s75 đã nhận 38 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Board clone API failure is treated as a successful board responseCó thể đã có người làm @Kumar-s75 đã nhận 38 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
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 78/100
nextcloud/deck#8334 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Date picker should automatically open popupCó thể đã có người làm @theoholl đã nhận 46 ngày trước. Đang mở1. to develop enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
nextcloud/deck#8110 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của nextcloud/deck
Issue tương tự
-
effort:low model:light plan planner:fable-5-1 test-quality tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: agent area: theme help wanted lane: free-agent roadmap size: S status: needs-brief type: layout type: task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
arminazimi/slipway#64 ·
-
release:v5.34
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Jason-Vaughan/TangleClaw#2469 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hacktoberfest help wanted skip-changelog
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
wassim-azi/agy-powerline#74 ·
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 67/100
MadeBaruna/paimon-moe#696 ·