File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -284,8 +284,9 @@ public function feedzy_register_rest_route() {
284284 array (
285285 'methods ' => 'POST ' ,
286286 'callback ' => array ( $ this , 'feedzy_rest_route ' ),
287- 'permission_callback ' => function () {
288- return is_user_logged_in ();
287+ 'permission_callback ' => function ( WP_REST_Request $ request ) {
288+ $ post_id = absint ( $ request ->get_param ( 'postId ' ) );
289+ return current_user_can ( 'edit_post ' , $ post_id );
289290 },
290291 'args ' => array (
291292 'url ' => array (
@@ -398,12 +399,14 @@ public function feedzy_rest_route( $data ) {
398399 */
399400 public function feedzy_sanitize_feeds ( $ input ) {
400401 if ( count ( $ input ) === 1 ) {
401- $ feed = esc_url ( $ input [0 ] );
402+ $ feed = wp_http_validate_url ( $ input [0 ] );
402403 return $ feed ;
403404 } else {
404405 $ feeds = array ();
405406 foreach ( $ input as $ item ) {
406- $ feeds [] = esc_url ( $ item );
407+ if ( wp_http_validate_url ( $ item ) ) {
408+ $ feeds [] = esc_url_raw ( $ item );
409+ }
407410 }
408411 return $ feeds ;
409412 }
Original file line number Diff line number Diff line change @@ -194,11 +194,12 @@ class Editor extends Component {
194194 . filter ( ( item ) => item !== '' ) ;
195195 url = queryString . stringify ( { url } , { arrayFormat : 'bracket' } ) ;
196196 }
197+ const postId = wp . data . select ( 'core/editor' ) . getCurrentPostId ( ) ;
197198
198199 apiFetch ( {
199200 path : `/feedzy/v1/feed?${ url } ` ,
200201 method : 'POST' ,
201- data : this . props . attributes ,
202+ data : { ... this . props . attributes , postId : postId } ,
202203 } )
203204 . then ( ( data ) => {
204205 if ( this . unmounting ) {
You can’t perform that action at this time.
0 commit comments