API: getting one blog does not accept ?body=html, but getting all blogs does
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先定位 /api/collections/{alias}/posts 和 /api/collections/{alias}/posts/{slug} 的 handlers 或入口点,然后比较每个 route 如何读取 body 查询参数。验证单个 post 的响应是否像 collection 响应一样遵循 ?body=html,并确认省略该参数时两个 route 仍会返回预期的数据。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When using the WriteFreely API to get all of a blog's posts, you can pass the parameter ?body=html to get HTML-formatted blog bodies.
/api/collections/test/posts?body=html
{
"code": 200,
"data": {
"alias": "test",
"title": "Test Blog",
"description": "Hello, world!",
"style_sheet": "",
"public": true,
"format": "blog",
"views": 0,
"url": "https://example.com/test/",
"verification_link": "",
"total_posts": 1,
"posts": [
{
"id": "34hr3jrjjt",
"slug": "test",
"appearance": "norm",
"language": "en",
"rtl": false,
"created": "2023-08-23T00:00:00-05:00",
"updated": "2023-10-11T21:06:45-05:00",
"title": "Test",
"body": "<h1>This is a test.</h1>\n<a href="https://example.com/">Hello, world!</a>",
"tags": [],
"paid": false,
"views": 1
}
],
"Format": null
}
}
However, when getting one of a blog's posts, this parameter is no longer accepted and the body becomes Markdown.
/api/collections/test/posts/test?body=html
{
"code": 200,
"data": {
"id": "34hr3jrjjt",
"slug": "test",
"appearance": "norm",
"language": "en",
"rtl": false,
"created": "2023-08-23T00:00:00-05:00",
"updated": "2023-10-11T21:06:45-05:00",
"title": "Test",
"body": "# This is a test.\n[Hello, world!](https://example.com/)",
"tags": [],
"paid": false,
"views": 1
}
}
Expected behavior
The API should accept the ?body=html parameter on both routes, so blogs can be returned in HTML, regardless of the method.
Application configuration
- Single mode or Multi-user mode?: Multiple users
- Database?:
mysql - Open registration?: Invite-only
- Federation enabled?: yes
Version or last commit: WriteFreely v0.14.0 on Ubuntu 22.04.3 LTS x86_64
- 主要语言
- Go
- 星标
- 5.3k
- 派生
- 413
- 平均合并
- 3 天 5 小时
- 30 天内合并 PR
- 4
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
writefreely/writefreely 的其他 Issue
-
Docker healthcheck logs a 500 on every check可能已有人在做 @zackwag 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
writefreely/writefreely#1801 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
writefreely/writefreely#1764 · 1 条评论 ·
维护者通常 2 天内回复
-
panic: nil pointer dereference in initActivityPub when App.Host is empty or invalid可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
writefreely/writefreely#1753 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
writefreely/writefreely#1750 · 1 条评论 ·
维护者通常 2 天内回复
-
Accessibility: blog-menu-customize-CSS edit field cannot be read by blind users through screen readers可能已有人在做 @thebaer 于 24 天前认领。 未关闭accessibility
难度 3/5 1-2 天 新手友好度 52/100
writefreely/writefreely#1776 · 5 条评论 ·
维护者通常 2 天内回复
查看 writefreely/writefreely 的全部 Issue
相似的 Issue
-
agent/strategist help wanted roadmap
难度 2/5 1-3 小时 新手友好度 62/100
kubestellar/kubestellar-mcp#1414 · 1 条评论 ·
维护者通常 1 天内回复
-
area: pipeline priority: low type: bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area: widgets type: bug
难度 2/5 1-3 小时 新手友好度 82/100
itadori26/trisse-home#905 ·
-
[Bug]: Packer activity unjoined-runtime test is flaky on Linux可能已有人在做 @depohmel 今天认领。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
dsx-ai-factory/nvkr#707 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nightgauge/nightgauge#3872 ·
维护者通常 1 天内回复