Skip to content

ImageFixtures preview doesn't show correctly when editing in the admin (Windows) #1978

@luistar15

Description

@luistar15

ImageFixtures uses backward slash (\) as directory separator for relative paths in Windows.
Example: stock\image_40672.jpg

This causes problems when using in Vue as a css background-image property (probably parsed as an escape sequence):
stockimage_40672.jpg

Since PHP works the same with paths using / as a separator and since the / is the path separator in URLs, I think we should use it in this case.

To fix this issue I tried to change the separator from the beginning in the origin.
Symfony/Finder uses RecursiveDirectoryIterator wich suports UNIX_PATHS, but Symfony/Finder doesn't allow such configuration.

The next best thing I think is to replace the separator before storing it in the database.

Details

Question Answer
Operating System Windows
Relevant Bolt Version 4.1
Install type Composer install
BC Break no
PHP version 7.4
Web server Built-in
For UX/UI issues Browser name and version

Reproduction

Steps to reproduce

  • Install bolt composer create-project bolt/project myproject
  • Setup bolt with fixtures (dummy content)
  • Start built-in server bin\console server:run
  • Edit any people entry

Expected result

The preview of the image field should be displayed.

Actual result

The preview of the image field doesn't show.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions