Skip to content

File block with a pdf upload becomes invalid in the editor when changing languages #43013

Closed

Description

Description

Discovered in #42745 (comment).

The file block uses __ in its save function. It's a static block so the internationalized output causes the block to be non-deterministic, resulting in validation errors.

Typically save output for static blocks can't be internationalized.

This could be a tricky one to solve, as removing the use of __ could cause a lot of blocks added in the non-default language to become invalidated. Maybe a deprecation is possible though.

Step-by-step reproduction instructions

To repro (in the post editor):

  1. Upload a pdf to a file block
  2. Publish the post
  3. Change to a different language
  4. Reload the post in the editor
  5. Observe that the file block now has a validation error

I would recommend reproducing without the Gutenberg plugin active, as a lot of the translations are missing (at least for the dev version).

Screenshots, screen recording, code snippet

Screen Shot 2022-08-05 at 12 33 52 pm

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Block] FileAffects the File Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions