Making WordPress.org

Opened 8 years ago

Closed 8 years ago

#3011 closed defect (bug) (fixed)

Plugin Directory: Disallow changing the slug to an existing plugin's slug

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: otto42's profile Otto42
Milestone: Plugin Directory v3.0 Priority: high
Component: Plugin Directory Keywords: has-patch
Cc:

Description (last modified by SergeyBiryukov)

Background: discussion in #meta with @otto42 and @ipstenu.

Under some circumstances, it's possible to have plugins with duplicate slugs:

  1. Open a plugin with a new (Pending Initial Review) status for editing.
  2. Change the slug to another existing plugin's slug.
  3. Click "Mark as Pending".
  4. There are now two plugins with the same slug. Whichever one is updated next will get a -2 appended to its slug, causing some confusion.

Changing the slug to another existing plugin's slug should be disallowed.

Some technical details: this happens because wp_unique_post_slug() bails early when dealing with a pending post. Both get_sample_permalink() and wp_ajax_inline_save() have a hack to prevent that by faking a'publish' status, but get_sample_permalink() does not run on Edit Plugin screen, so some additional checks are needed.

Attachments (1)

3011.patch (3.1 KB) - added by SergeyBiryukov 8 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
8 years ago

  • Keywords has-patch added

3011.patch shows an error when trying to use an existing plugin's slug, either on Edit Plugin screen or via Quick Edit.

@SergeyBiryukov
8 years ago

#2 @SergeyBiryukov
8 years ago

  • Description modified (diff)

#3 @Otto42
8 years ago

  • Owner set to Otto42
  • Resolution set to fixed
  • Status changed from new to closed

In 5727:

Plugin Directory: Prevent plugin slugs from clashing. Fixes #3011. props @SergeyBiryukov

Note: See TracTickets for help on using tickets.