Making WordPress.org

Changeset 12996


Ignore:
Timestamp:
12/04/2023 01:21:51 AM (2 years ago)
Author:
dd32
Message:

HelpScout: Properly detect the plugin for an email when the plugin name contains characters that would be HTML escaped within the database.

For example, this previously failed with the plugin title A & B which is stored as A & B.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/common.php

    r12843 r12996  
    290290        switch_to_blog( WPORG_PLUGIN_DIRECTORY_BLOGID );
    291291        $plugins = get_posts( [
    292             'title'       => trim( $m['title'] ),
     292            // Post titles are always escaped.
     293            'title'       => esc_html( trim( $m['title'] ) ),
    293294            'post_type'   => 'plugin',
    294295            'post_status' => 'any',
    295296        ] );
     297
     298        // Although the above should always catch it, let's try again with the unescaped title.
     299        if ( ! $plugins ) {
     300            $plugins = get_posts( [
     301                'title'       => trim( $m['title'] ),
     302                'post_type'   => 'plugin',
     303                'post_status' => 'any',
     304            ] );
     305        }
    296306        restore_current_blog();
    297307
Note: See TracChangeset for help on using the changeset viewer.