Deleting/updating file attachments fails with 404 — frontend calls singular attachment/{type}:{id} but OCS route is plural attachments/{id}
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- javascript, php
调研方向
从 src/services/attachment.js 开始,将 deleteAttachment()、updateAttachment() 和 restoreAttachment() 与 appinfo/routes.php 及 AttachmentOcsController 中的 OCS 路由进行比较。根据已确认可正常工作的 DELETE 调用,验证请求路径和参数,然后执行移除、更新和恢复文件附件,以确认这三项操作都能成功。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- JavaScript
- 星标
- 1.4k
- 派生
- 358
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 83
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nextcloud/deck 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
CSV export leaves trailing commas in tags and assigned-user fields可能已有人在做 @Kumar-s75 于 39 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
Board clone API failure is treated as a successful board response可能已有人在做 @Kumar-s75 于 39 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Date picker should automatically open popup可能已有人在做 @theoholl 于 47 天前认领。 未关闭1. to develop enhancement
难度 2/5 1-3 小时 新手友好度 68/100
nextcloud/deck#8110 · 1 个 reaction ·
维护者通常 1 天内回复
相似的 Issue
-
idnits3
难度 2/5 1-3 小时 新手友好度 76/100
ietf-tools/idnits#363 ·
维护者通常 1 天内回复
-
prototype(verifier_token): map disallowed warning to contraindicated before composite precedence check可能已有人在做 @drk-ram 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
agentrust-io/trace-spec#582 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 72/100
TheOdinProject/curriculum#31479 ·
维护者通常 1 天内回复
-
chore
难度 2/5 1-3 小时 新手友好度 76/100
SignalK/n2k-signalk#368 ·
维护者通常 1 天内回复