Jetpack: Cannot upload mp3 files via Calypso because an API call to a Jetpack sites does not return mp3 as an allowed file type

Created on 10 May 2017  路  15Comments  路  Source: Automattic/jetpack

Because I can upload mp3 files via WP Admin for a Jetpack site, I expected to also be able to upload mp3 files via Calypso for a Jetpack site without a plan. Is this expectation valid?

Steps to reproduce:

  1. You will need a Jetpack site connected to WordPress.com without a Jetpack Plan.
  2. Go to https://developer.wordpress.com/docs/api/console/
  3. Sign in as the owner of the site from step 1 and query WP.COM API v1.1 for /me/sites.
  4. Browse to root > sites > {site from step 1} > options > allowed_file_types.
  5. Check to see whether mp3 is an allowed file type.

Result: for a free Jetpack site connected to WordPress.com, mp3 is not an allowed file type.

screen shot 2017-05-09 at tue may 9 4 09 04 pm
Seen at https://developer.wordpress.com/docs/api/console/ using Chrome 58.0.3029.96 on Mac OS X 10.12.4 logged in as user663 and viewing /me/sites details for designsimply-automated-transfer-4.blog

WPCOM API [Package] Sync [Pri] High [Type] Bug

Most helpful comment

/me/sites always returns data from wpcom and it seems like we are not syncing allowed_file_types so it is impossible that we return that right :(

All 15 comments

This issue came up for an AT user today in #367824-hc

The /sites/$site API endpoint (#) gets its allowed_file_types directly from WordPress options, thanks to get_allowed_mime_types(). On most self-hosted WordPress sites, mp3 files are part of the allowed file types (there are a few exceptions, like sites part of a Multisite network). 128218733 is an example: it's a single WordPress site, connected to WordPress.com via Jetpack, on a free plan, and mp3 are available:

screen shot 2017-05-10 at 16 20 44

Yet I still can't upload Audio files via the WordPress.com Post editor:

screen shot 2017-05-10 at 16 27 47

It would appear that the list of allowed file types in the post editor doesn't respect what's given by the site endpoint in the API.

That seems to be because the post editor uses another endpoint to get that information: me/sites (#). That endpoint, not part of Jetpack, returns the wrong information for allowed_file_types. If we look at the same site again:

screen shot 2017-05-10 at 16 35 57

I'm not quite sure why that's happening, since the 2 endpoints seem to rely on the same file to actually build the list, https://github.com/Automattic/jetpack/blob/master/sal/class.json-api-site-jetpack.php#L96-L106

@lezama Would you mind taking a look?

Thanks!

/me/sites always returns data from wpcom and it seems like we are not syncing allowed_file_types so it is impossible that we return that right :(

@lezama Thanks for jumping in! I guess that means Poseidon can fix it? :)

Reported by an AT user in #428239-hc as well.

Reported in 3269099-t indirectly as well

Upgrading to High priority due to the impact to AT sites.

Another one in #3315146-t , AT.

I see it's set to high priority indeed, but been about a month. Can we expect a fix soon?

Sorry for the delay on this one.

Today I investigated this a bit more, and it is not an easy one.

On self-hosted sites "allowed file types" are on a per user basis 馃槺

I created a patch D6342 that should improve /me/sites for the AT case. While we work on a more complex but generic solution.

3317614-t AT

@designsimply could you help me to 馃殺 https://github.com/Automattic/wp-calypso/issues/16099?

Another AT user in #520405-hc .. looks like PR above is all set and waiting a review.

524152-hc AT (and #3341471-t)

514694-hc AT and #3338219-t AT

Was this page helpful?
0 / 5 - 0 ratings