@@ -404,6 +404,7 @@ public function prepare_upload( $post, $push_sync = false ) {
404404 if ( true === $ push_sync ) {
405405 $ download = $ this ->sync ->managers ['download ' ]->down_sync ( $ post ->ID );
406406 if ( is_wp_error ( $ download ) ) {
407+ delete_post_meta ( $ post ->ID , Sync::META_KEYS ['downloading ' ] );
407408 update_post_meta ( $ post ->ID , Sync::META_KEYS ['sync_error ' ], $ download ->get_error_message () );
408409
409410 return new \WP_Error ( 'attachment_download_error ' , $ download ->get_error_message () );
@@ -541,7 +542,7 @@ public function prepare_upload( $post, $push_sync = false ) {
541542 $ suffix_data = wp_parse_args ( $ suffix_meta , $ suffix_defaults );
542543
543544 // Prepare a uniqueness check and get a suffix if needed.
544- if ( true === $ push_sync ) {
545+ if ( true === $ push_sync && true !== $ downsync ) {
545546 if ( $ public_id !== $ suffix_data ['public_id ' ] || empty ( $ suffix_data ['suffix ' ] ) ) {
546547 $ suffix_data ['suffix ' ] = $ this ->sync ->add_suffix_maybe ( $ public_id , $ post ->ID );
547548 if ( ! empty ( $ suffix_data ['suffix ' ] ) ) {
@@ -681,6 +682,7 @@ public function push_attachments( $attachments ) {
681682 $ error = $ result ->get_error_message ();
682683 $ stats ['fail ' ][] = $ error ;
683684 $ this ->media ->update_post_meta ( $ attachment ->ID , Sync::META_KEYS ['sync_error ' ], $ error );
685+ delete_post_meta ( $ attachment ->ID , Sync::META_KEYS ['syncing ' ] );
684686 continue ;
685687 }
686688
0 commit comments