Making WordPress.org

Changeset 6422


Ignore:
Timestamp:
01/24/2018 07:36:47 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: API: Return a proper error message for api.wordpress.org/plugin/info/ when the plugin cannot be found.
WordPress itself expects the null response, and currently uses the info/1.0 endpoint which returns PHP, so we'll retain this carveout for it.

These URLs now return an error message:
​https://api.wordpress.org/plugins/info/1.0/non-existant-plugin.json
​https://api.wordpress.org/plugins/info/1.0/non-existant-plugin.xml
​https://api.wordpress.org/plugins/info/1.1/?action=plugin_information&request[slug]=non-existant-plugin

Fixes #111.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php

    r6287 r6422  
    8383                }
    8484
    85                 // Backwards compatibility; the API returns null in case of error..
    86                 if ( isset( $response['error'] ) ) {
     85                // Backwards compatibility; the PHP api endpoints return `null` in case of an error.
     86                if ( isset( $response['error'] ) && 'php' === $this->format ) {
    8787                        $this->output( null );
    8888                        return;
Note: See TracChangeset for help on using the changeset viewer.