Automattic / Automattic/php-toolkit

bug: PushMD - path conflict on duplicate slug for posts in draft

オープン
#95 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
22
フォーク
5
PR マージ指標
30日以内にマージされた PR はありません

説明

WordPress allows multiple non-published posts (e.g. draft, pending) to share the exact same post_name slug (e.g., my-draft-post). When exporting via Git (git clone / git fetch), PushMD attempts to write both posts to post/my-draft-post.md, causing a file path collision exception: Git export rejected because multiple WordPress entities map to the same PushMD path.

We can disambiguate duplicate slug collisions during export by falling back to ID-based paths (e.g., post/post-202.md) for colliding entries (giving published posts priority).

**Proposed Changes**
Push MD Plugin
[MODIFY] class-push-md-plugin.php
Update export_wordpress_content() to handle slug collisions gracefully.
Sort posts during export prioritize published posts before draft/pending/private posts.
When two or more posts resolve to the exact same repository markdown path, assign the human-readable slug path to the primary post and fallback to build_id_fallback_markdown_path($post) (post/post-.md or page/page-.md) for duplicate entries.

[MODIFY] ExportPathTest.php
Add unit tests verifying that multiple draft posts with identical slugs export cleanly without throwing exceptions, using ID fallback paths for duplicates.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

class-push-md-plugin.php の export_wordpress_content() から始め、投稿がどのようにリポジトリの Markdown パスになるかを確認します。次に ExportPathTest.php を調べ、同じ slug を共有する複数の下書きまたは保留中の投稿について、公開済み投稿の優先順位を含むテストカバレッジを追加します。エクスポートがパスの衝突なしに完了し、重複したエントリが ID ベースのフォールバックパスを使用すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
76/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。