Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

Restoring an image to original in Calypso fails. #14388

Open zinigor opened 4 years ago

zinigor commented 4 years ago

After editing (cropping) an image in Calypso an attempt to restore it to its original state fails.

Steps to reproduce the issue

  1. Go to the media library in Calypso for a Jetpack site.
  2. Click on any image (upload one if there's none).
  3. Crop it in the editor.
  4. Click the "Restore original" button.

What I expected

An image to be restored to its original dimensions.

What happened instead

The request fails, the spinner never stops spinning, the image is not restored. The UI is locked, only a refresh helps. If you're looking at the logs, you'll see something like this:

NOTICE: PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function wpcom_get_private_file() in /var/dev/wordpress/wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-edit-media-v1-2-endpoint.php:296
Stack trace:
#0 /var/dev/wordpress/wp-content/plugins/jetpack/json-endpoints/class.wpcom-json-api-edit-media-v1-2-endpoint.php(370): WPCOM_JSON_API_Edit_Media_v1_2_Endpoint->build_file_array_from_url('8051', 'https://lousy.s...')
#1 /var/dev/wordpress/wp-content/plugins/jetpack/class.json-api.php(346): WPCOM_JSON_API_Edit_Media_v1_2_Endpoint->callback('/sites/10281254...', 1, '8051')
#2 /var/dev/wordpress/wp-content/plugins/jetpack/class.json-api.php(330): WPCOM_JSON_API->process_request(Object(WPCOM_JSON_API_Edit_Media_v1_2_Endpoint), Array)
#3 /var/dev/wordpress/wp-content/plugins/jetpack/packages/connection/legacy/class-jetpack-xmlrpc-server.php(914): WPCOM_JSON_API->serve(false)
#4 /var/dev/wordpress/wp-includes/IXR/class-IXR-server.php(127): Jetpack_XMLRPC_Server->json_api(Array)...
stale[bot] commented 4 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

tyxla commented 2 years ago

Just reproduced this as I was working on testing [#58852](https://github.com/Automattic/wp-calypso/pull/58852. Would be a good one to fix IMHO.