fix(core): 修复微信公众号、掘金草稿封面未绑定的问题#204
Open
xiaoshuai1024 wants to merge 2 commits into
Open
Conversation
微信适配器此前完全忽略 article.cover,草稿的 fileid0/cdn_url0/ cdn_url_back0 始终为空,导致同步到草稿箱的文章没有封面。 修复: - uploadImageByUrl 返回值保留 res.content(fileid),原先是丢弃的 - publish 在构造表单前上传封面图(如有),拿 fileid + cdn_url - 将 fileid0/cdn_url0/cdn_url_back0 填入上传结果 - 封面上传失败不阻断正文发布,记录警告后继续 实测:通过 CLI 同步带封面的文章到草稿箱,封面正常显示。
掘金适配器声明了 cover 能力但 publish 中 cover_image 始终硬编码为空, 导致同步的草稿没有封面。 修复:publish 中若 article.cover 存在,先调用 uploadImageByUrl 上传到 掘金图床(ImageX),拿到的 URL 填入 cover_image 字段。上传失败不阻断 正文发布,记录警告后继续。 与微信封面修复(wechatsync#204)采用相同思路。
Author
|
Hi maintainers, gentle ping on this PR -- it's been open for ~2 weeks with no review activity. SummaryFixes the draft cover image not being bound when syncing to:
Scope
Why I'm bumping thisBoth are real regressions visible to users (see recent issues around 小红书 long-form sync stuck and local image upload hanging -- the adapter layer is where these surface). Happy to help triage further if useful. Status
Would appreciate a quick look. If there's a different target branch or a changelog/test convention I missed, happy to adjust. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
通过 CLI / MCP 同步文章时,传入的 `cover`(封面图)没有生效,草稿箱里的文章始终没有封面。
定位发现多个适配器完全忽略了 `article.cover`,封面相关字段硬编码为空:
修复
采用统一思路:`publish` 中若 `article.cover` 存在,先上传到平台图床拿 URL/fileid,填入对应字段;上传失败不阻断正文发布,记录 `logger.warn` 后继续。
`packages/core/src/adapters/platforms/weixin.ts`(+21 / -3):
`packages/core/src/adapters/platforms/juejin.ts`(+14 / -1):
`ImageUploadResult.attrs` 字段本就存在,无需改动类型定义。`sync-service.ts` 也早已把 `article.cover` 透传到 `publish`,链路完整。
验证
背景
说明
本 PR 只覆盖微信与掘金两个适配器。知乎适配器也存在「声明了 `cover` 能力但 `publish` 未处理」的情况,但其草稿接口的封面字段未公开、需抓包确认,留作后续单独 PR。