Validate that uploaded .po files are UTF8

Created on 12 June 2012, over 12 years ago
Updated 5 September 2024, 3 months ago

Problem/Motivation

For the moment there's no check if the file is UTF8 or not

Steps to reproduce

Try to upload file on with non UTF-8 encoding on admin/config/regional/translate/import, it uploads without any validation.

Proposed resolution

Include new validation plugin to check if the uploaded file is encoded with UTF8.

Remaining tasks


User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

RTBC

Version

11.0 ๐Ÿ”ฅ

Component
Localeย  โ†’

Last updated 6 days ago

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium attiks

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue was unassigned.
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    I rebased the MR onto 11.x but there are errors to fix.

  • First commit to issue fork.
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    Not the most elegant solution, but does the job.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    All issues should be resolved now.

  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Ran test-only feature

    1) Drupal\Tests\locale\Functional\LocaleImportFunctionalTest::testStandalonePoFile
    Behat\Mink\Exception\ResponseTextException: The text "The file is not encoded with UTF-8" was not found anywhere in the text of the current page.
    /builds/issue/drupal-1630568/vendor/behat/mink/src/WebAssert.php:907
    /builds/issue/drupal-1630568/vendor/behat/mink/src/WebAssert.php:293
    /builds/issue/drupal-1630568/core/tests/Drupal/Tests/WebAssert.php:975
    /builds/issue/drupal-1630568/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php:257
    FAILURES!
    Tests: 6, Assertions: 136, Failures: 1.
    

    Which shows the coverage.

    Believe all feedback on the MR has been addressed.

  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    This is almost there. I left a few comments to look at.

  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    I think other threads are solved, but still open to suggestions if the FileEncoding constraint $encoding should be list of encodings.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    Sorry that I missed that this will need tests of the new constraint validator.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    I added tests for FileEncodingConstraint. Instead of list I converted $encoding into an array, IMO it makes the code cleaner: no need for implode or preg_* that FileExtensionConstraint is using.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States nicxvan

    I reviewed this and it looks great.

    All of the threads seem to be resolved.

    I tried to run the test only job, but it wouldn't run due to:
    This job could not start because it could not retrieve the needed artifacts.
    Learn more about dependencies and common causes of this error.

    The actual tests are passing.

  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Rebased and got test-only to run https://git.drupalcode.org/issue/drupal-1630568/-/jobs/2659732

    Re-looking at believe all feedback has been addressed

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Committed 02b324c and pushed to 11.x. Thanks!

    • alexpott โ†’ committed a61ad676 on 11.x
      Issue #1630568 by sokru, Laureatus, quietone, smustgrave, ravi.shankar:...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024