Lowercase `post` media uploads skip the draft post ID strip
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, wordpress
- Lĩnh vực
- backend
Hướng nghiên cứu
Read src/utils/api-fetch.js and trace middleware registration order, especially stripDraftPostIdMiddleware and the wrapper around core's mediaUploadMiddleware. Check the existing tests for api-fetch middleware behavior, then verify that lowercase method: 'post' is uppercased before the draft ID is stripped and that the wrapper's duplicate conversion can be removed. Done means the request no longer sends post=-1.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A media upload sent with a lowercase method: 'post' keeps the placeholder post=-1 field. stripDraftPostIdMiddleware is meant to remove it before the request reaches WordPress.
Follow-up from #594. The behavior is the same on trunk, so it wasn't introduced there.
What happens
stripDraftPostIdMiddleware in src/utils/api-fetch.js only acts when options.method === 'POST'. A plugin calling apiFetch( { path: '/wp/v2/media', method: 'post', body } ) skips it, and WordPress receives post=-1.
Gutenberg's own uploads send POST, so this only affects third-party code.
Suggested fix
Uppercase options.method in a small middleware registered so it runs before every other GutenbergKit middleware. #594 already uppercases the method inside its wrapper around core's mediaUploadMiddleware (fcf8f0300), but that wrapper runs after stripDraftPostIdMiddleware. Moving the uppercasing up would cover both, and the wrapper's copy could then be removed.
fetch uppercases the standard methods itself, so nothing further down sees a difference.
- Ngôn ngữ chính
- JavaScript
- Star
- 29
- Fork
- 6
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 76
Chuẩn bị môi trường
- 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 wordpress-mobile/GutenbergKit
-
[Type] Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
wordpress-mobile/GutenbergKit#940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Type] Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
wordpress-mobile/GutenbergKit#884 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Type] Bug Android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
wordpress-mobile/GutenbergKit#847 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Type] Bug iOS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
wordpress-mobile/GutenbergKit#846 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Type] Bug [Type] Code Quality iOS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
wordpress-mobile/GutenbergKit#668 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wordpress-mobile/GutenbergKit
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 13 ngày
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner schemeCó thể đã có người làm @Bensonbenyi đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Mintplex-Labs/anything-llm#7338 ·
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 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: no-derived-state crashes on a call through a TypeScript import-equals alias (`import x = A.b`)Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect#90 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
semantic-release/semantic-release#4375 ·
Maintainer thường phản hồi trong vòng 1 ngày