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

File Block:Adding a custom style to a file block will register two upload files. #32157

Closed
imawc opened this issue May 24, 2021 · 2 comments · Fixed by #32350
Closed

File Block:Adding a custom style to a file block will register two upload files. #32157

imawc opened this issue May 24, 2021 · 2 comments · Fixed by #32350
Assignees
Labels
[Block] File Affects the File Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@imawc
Copy link

imawc commented May 24, 2021

Description

If you add a custom style to the file block with register_block_style(), two upload files will be registered.

Step-by-step reproduction instructions

  1. Register a custom style in the file block with register_block_style()
  2. Upload a file in the file block
  3. Checking in the media, two files are registered.

Expected behaviour

Register only uploaded files.

Actual behaviour

Duplicated files will be registered at the same time.

Screenshots or screen recording (optional)

Code snippet (optional)

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version: Not installed
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

  • Device: Desktop
  • Operating system: Mac OS X 11.3.1
  • Browser: Chrome 90.0.4430.212
@Mamaduka Mamaduka added [Block] File Affects the File Block Needs Testing Needs further testing to be confirmed. labels May 24, 2021
@Mamaduka
Copy link
Member

I was able to reproduce the issue.

Example code for custom File block style:

add_action( 'init', function() {
    register_block_style(
        'core/file',
        [
            'name'  => 'file-test-style',
            'label' => 'File test style'
        ]
    );
} );

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels May 24, 2021
@imawc
Copy link
Author

imawc commented May 24, 2021

@Mamaduka
Ah, so it was a bug after all.
Thanks for reproducing the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] File Affects the File Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants