WordPress.org

Making WordPress.org

Opened 6 years ago

Closed 6 years ago

#157 closed defect (fixed)

Invalid Plugin Contributors JSON from WP.org Plugin API

Reported by: bpetty Owned by:
Milestone: Priority: low
Component: API Keywords:
Cc:

Description

Migrating from #wp23822:

Under some rare conditions, some plugins can break the plugin API with invalid JSON, specifically in regards to the list of contributors returned. This is likely because of the string encoding used to either parse or store the values returned from the plugin file headers.

Basically though, it results in using a null name for a JSON object member where there absolutely needs to be a string.

For example, the "Aaaaah Lek Lek" plugin (aaaaaaah-lek-lek) returns the following JSON:

{
    "name": "Aaaaah Lek Lek",
    "slug": "aaaaaaah-lek-lek",
    "version": "1.0",
    "author": "<a href=\"http:\/\/valeriosouza.com.br\">Val&#233;rio Souza<\/a>",
    "author_profile": "http:\/\/profiles.wordpress.org\/valeriosza",
    "contributors": {
        null: ""
    },
    "requires": "3.0.1",
    "tested": "3.5.1",
    "compatibility": [
        
    ],
    "rating": 0,
    "num_ratings": 0,
    "downloaded": 20,
    "last_updated": "2013-03-12",
    "added": "2013-03-12",
    "homepage": "http:\/\/valeriosouza.com.br",
    "sections": {
        "description": "<p>Coloque a frase da m&#250;sica LekLek em seu WordPress, dentro do painel administrativo.<\/p>",
        "installation": "<p>Siga para Instalar<\/p>\n\n<ol>\n<li>Fa&#231;a Upload <code>aaaaaaah-lek-lek<\/code> para a pasta <code>\/wp-content\/plugins\/<\/code><\/li>\n<li>Ative no menu 'Plugins' no seu WordPress<\/li>\n<\/ol>",
        "changelog": "<h4>1.0<\/h4>\n\n<ul>\n<li>Lan&#231;ada Vers&#227;o 1.<\/li>\n<\/ul>",
        "faq": "<h4>What about foo bar?<\/h4>",
        "other_notes": "<h3>Arbitrary section<\/h3>"
    },
    "short_description": "Coloque o Lek Lek no seu WordPress",
    "download_link": "http:\/\/downloads.wordpress.org\/plugin\/aaaaaaah-lek-lek.zip",
    "tags": {
        "frases": "frases",
        "leklek": "leklek"
    }
}

JSONLint comes back with:

Parse error on line 7:
...ibutors": {        null: ""    },    
----------------------^
Expecting 'STRING', '}'

These plugin details come from these files:

(it mentions a stable tag, but there are no actual tags)

You might also notice that Extend is unable to display these details correctly either: http://wordpress.org/extend/plugins/aaaaaaah-lek-lek/

comment 1:

FWIW, that readme.txt file is in Windows-1252 instead of UTF-8.

comment 2:

I could still use a fix on this btw...

Additionally, here's the full list of plugins that trigger this same error for the same reason:

aaaaaaah-lek-lek
snapicious-for-wordpress
wp-jqtransform-archive
check-links-intercambios
flogmaker
envato-referral
tres-noticias-principais
landing-sites
flash-tag-cloud
single-categories
wice-contact-for-wordpress
chatbot-widget
flashblog

Here's another plugin with this encoding problem, but with tags rather than contributors:

sns

Change History (2)

#1 @bpetty
6 years ago

  • Cc bryan@… added

#2 @Otto42
6 years ago

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

I modified the /plugins/info api to do UTF-8 encoding on the contributor name field in the response. This won't necessarily guarantee correct results, but it will at least prevent that non-ascii data from buggering up the json.

Note: See TracTickets for help on using tickets.