-
Notifications
You must be signed in to change notification settings - Fork 6
PATCH routes: support field_attributes #167
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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