Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add a multipart encoder to GutenbergKitHTTP and delete the duplicated multipartBodyStream

未关闭
#545 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
冷清
技术栈
swift
领域
api

调研方向

从 ios/Sources/GutenbergKitHTTP/MultipartPart.swift 和 RequestBody.swift 开始,将 parser 与 makePipedFileSliceStream 进行比较。然后检查 MediaUploadServer.swift,追踪 multipartBodyStream 和 writeAll。完成的标准是:encoder 会流式传输所有 MultipartPart 值,media re-encode 路径会使用它,并且删除重复的 helper,同时不会丢失非文件部分。

由索引模型根据 Issue 内容生成。

描述

Summary

GutenbergKitHTTP has a multipart parser (MultipartPart.parse / parseChunked) but no encoder. The only multipart-building code is MediaUploadServer.multipartBodyStream, which is file-only, hand-rolled, and duplicates RequestBody.makePipedFileSliceStream nearly verbatim — its own doc comment notes it uses "the same pattern as" that helper.

Surfaced during the #357 upload-relay review.

Proposal

Add the encode counterpart to GutenbergKitHTTP: a multipart encoder that takes [MultipartPart] (+ boundary) and streams each part's RequestBody through the same bound-stream primitive makePipedFileSliceStream already uses.

Then:

  • The media-upload re-encode path builds [processed-file part] + [original non-file parts] and calls the encoder, instead of hand-writing the multipart.
  • Delete MediaUploadServer.multipartBodyStream / writeAll.
  • GutenbergKitHTTP gains a symmetric parse ⇄ encode pair.

Context

Split out of #357. The immediate need there — forwarding post / additionalData through the re-encode path — is handled inline via a preamble extension of multipartBodyStream. This issue tracks the cleaner refactor that also removes the duplication.

Files

  • ios/Sources/GutenbergKitHTTP/MultipartPart.swift — parser
  • ios/Sources/GutenbergKitHTTP/RequestBody.swift — makePipedFileSliceStream
  • ios/Sources/GutenbergKit/Sources/Media/MediaUploadServer.swift — multipartBodyStream (to delete)
主要语言
JavaScript
星标
29
派生
7
平均合并
2 天 3 小时
30 天内合并 PR
71

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

wordpress-mobile/GutenbergKit 的其他 Issue

查看 wordpress-mobile/GutenbergKit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。