Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing a warning on the avatar endpoint #195

Closed
marioshtika opened this issue Jul 19, 2019 · 6 comments

Comments

@marioshtika
Copy link

commented Jul 19, 2019

I am uploading an avatar through the endpoint /wp-json/buddypress/v1/members/1/avatar and the below warning is shown:

Warning: unlink(/path_from_root/wp-content/uploads/avatars/1/image.jpg): No such file or directory in /path_from_root/wp-content/plugins/BP-REST/includes/bp-attachments/classes/trait-attachments.php on line 102
[{"full":"https:\/\/website_url\/wp-content\/uploads\/avatars\/1\/5d31914f295a8-bpfull.jpg","thumb":"https:\/\/website_urll\/wp-content\/uploads\/avatars\/1\/5d31914f2d86c-bpthumb.jpg"}]

The upload is working and the response is correct I just can not retrieve it because of the warning message.

@renatonascalves

This comment has been minimized.

Copy link
Member

commented Jul 19, 2019

Are you using the file handler or is it one with a custom key?!

@marioshtika

This comment has been minimized.

Copy link
Author

commented Jul 19, 2019

Yes I am using the file handler.

@marioshtika

This comment has been minimized.

Copy link
Author

commented Jul 24, 2019

Hello @renatonascalves, any update on this?

@imath

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2019

What about doing a file_exists() check before using unlink() 😉

@marioshtika

This comment has been minimized.

Copy link
Author

commented Jul 26, 2019

I am guessing the image is being already deleted from the code in line 83

// Delete existing image if one exists.
$this->delete_existing_image();

Or is it something else?

@renatonascalves

This comment has been minimized.

Copy link
Member

commented Aug 1, 2019

@imath Thanks! Good idea! That should fix this warning!

@marioshtika Those are different things. The method is removing already uploaded avatars. The error you mention is the image is being uploaded.

We save it temporarily before cropping it.

@renatonascalves renatonascalves self-assigned this Aug 1, 2019

@renatonascalves renatonascalves added this to the before-bp-merge milestone Aug 1, 2019

@renatonascalves renatonascalves added this to Done in BP REST - V1 Aug 3, 2019

sjregan added a commit to sjregan/BP-REST that referenced this issue Aug 8, 2019

Merge branch 'master' of https://github.com/buddypress/BP-REST into d…
…ev/latest

* 'master' of https://github.com/buddypress/BP-REST: (282 commits)
  Use the view context to let regular users join a public group
  Improve the Group Membership endpoint arguments
  Status is not require, it musts be on of the valid stati
  Adapt Unit test and fix WPCS errors
  Improve Groups endpoint arguments and fix potential issues
  Apply Renato's recommandations
  Remove unnecessary note props @renatonascalves
  Make sure to keep the option to use the `bp_rest_xprofile_data_get_item_permissions_check` filter props @renatonascalves
  Fix a typo in a variable name Replace `$field_enpoint` by `$fields_endpoint` Props @renatonascalves
  Improve Profile data arguments and the way are retrieved field values
  Minor changes
  Improve Profile field arguments and some xProfile field features
  Improve arguments for the XProfile Groups endpoints & fix a bug
  Fixes buddypress#195
  Improve arguments description for the Activity endpoint methods
  Improve buddypress/v1/members/<id> & buddypress/v1/members/me routes
  Fix missing BuddyPress text domain
  Fix typos in inline doc
  Make sure the arguments for the Members CREATABLE method are consistent
  Make sure the collection params are consistent with BP_User_Query
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.