Skip to content

[Issue] Fixed media folder symlinks #40839

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #40837: Fixed media folder symlinks


Description (*)

The new validation gives errors when a situation uses atomic deployments where the media folder is set as a shared folder.

Given some debugging, we can see that the $quoteResolved path resolves the symlink:
/home/www/example.com/shared/pub/media/custom_options/quote

While the $mediaDirectory->getAbsolutePath() does not resolve symlinks:
/home/www/example.com/releases/000/pub/media/

By wrapping it in realPath we force it to resolve those symlinks and we end up comparing
/home/www/example.com/shared/pub/media/custom_options/quote to /home/www/example.com/shared/pub/media/ which is what we want to see in situations with a symlink

Manual testing scenarios (*)

  1. Make a symlink from pub/media to somewhere else (e.g. even an external disk)
  2. Attempt to add a product option file to your cart
  3. See how the Invalid file path. error gets throw.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: ready for confirmationReported on 2.4.xIndicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Ready for Confirmation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions