statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
104 stars 71 forks source link

Error Encountered: Invalid UTF-8 Encoding in YAML During Asset Import Process #225

Closed iSaadSalman closed 5 months ago

iSaadSalman commented 6 months ago

Bug Description

When executing the command php please eloquent:import-assets, encountering an error related to invalid UTF-8 encoding in YAML while trying to import assets.

Steps to Reproduce

  1. Run the command: php please eloquent:import-assets.
  2. Answer 'yes' to import asset containers.
  3. When prompted to import assets, answer 'yes' again.
  4. Observe the error encountered during the asset import process.

Expected Behavior

Expect the asset import to proceed without encountering a YAML encoding error.

Error Details

Do you want to import asset containers? (yes/no) [no]:
 > yes

1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Asset containers imported

Do you want to import assets? (yes/no) [no]:
 > yes

0/8765 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
Statamic\Yaml\ParseException 

The YAML value does not appear to be valid UTF-8.

at storage/statamic/tmp/yaml/1000_7625b72c46.jpg:-1
    1▕ ����\JFIF\\�\�\\��\;CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), quality = 90
    2▕ ��\C\
    3▕ 

    4▕ 

    5▕ 

    6▕ 
    7▕ 

       ��\C
    8▕ 

    9▕ ����"\��\\\\\\\\\\\

Additional Details

ryanmitchell commented 6 months ago

There has been a lot of changes to directory listing and imports at this PR: https://github.com/statamic/eloquent-driver/pull/224

It should solve this issue too

Bracketstech commented 5 months ago

@ryanmitchell I tried the latest (v3.0.1) but I'm still facing the issue

Screen Shot 2024-01-14 at 12 34 14 PM
ryanmitchell commented 5 months ago

Thanks. I plan to look into this further next week.

Bracketstech commented 5 months ago

@ryanmitchell Any ideas on how I can try to resolve it from my end?

ryanmitchell commented 5 months ago

I've opened a PR here - let me know if this works for you: https://github.com/statamic/eloquent-driver/pull/227

Bracketstech commented 5 months ago

@ryanmitchell Thanks so much. I tested your PR and after running php please eloquent:import-assets. it seems to have imported the media in DB. I will test further but for now it seems ok