PATCH routes: support field_attributes#167
Conversation
includes/class-mastodon-api.php
Outdated
| $data[ $name ] = $value; | ||
|
|
||
| // Handle different array forms. | ||
| if ( preg_match( '/^([^\[]+)\[\]$/', $name, $matches ) ) { |
There was a problem hiding this comment.
I guess the ([^\[]+) is technically correct but could it be more readable to use something like ([a-zA-Z0-9_]+) for easier readability?
There was a problem hiding this comment.
Or even (\w+) as per the docs:
\w
any "word" character
A "word" character is any letter or digit or the underscore character
There was a problem hiding this comment.
I agree that it's pretty ugly! I wasn't sure how permissive to be on this. I'm also going to reduce the surface area of what this code handles: only enough to support our use-case.
I'm slowly working up a patch for Core WP that'll patch things at the REST API level and then hopefully we can strip this all out.
|
@akirk finally had a chance to circle back to this, thanks for your feedback, I hope it's good to go! |
The
fields_attributesinapi/v1/update_credentialsare submitted in amultipart/form-datahash like:We were only handling the simple value type before.
This is required for Extra Fields editing in ActivityPub: Automattic/wordpress-activitypub#788