Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin doesn't work with project-level symlinks #89

Open
boyardnicolas opened this issue Jan 29, 2022 · 1 comment
Open

Plugin doesn't work with project-level symlinks #89

boyardnicolas opened this issue Jan 29, 2022 · 1 comment

Comments

@boyardnicolas
Copy link

On our staging server all the images detected from the DomManipulator are treated as not local pictures.
In ResponsiveImage class, the FileHelper::isLocalPath always returns false since the path of the picture sent as argument is the symlinked path (i.e /mnt/storage/staging/website/shared/storage/app/media/Icons/[email protected]), but in that method the base path used to compare is the real path of the project (i.e /mnt/storage/staging/website/releases/20220128095408/storage/app/media/Icons/[email protected]).
So for every project if you want to have zero downtime deployment using symlinked folders, you can't use this plugin as is.

Not sure where this issue should be tackled, plugin side, october side or laravel side.

If I remove that "isLocalPath" check from ResponsiveImage class the pictures are generated, the middleware also alter the html output, but it outputs the absolute path of the picture, using the symlinks (not real path) (https://website.domain/mnt/storage/staging/website/shared/storage/temp/public/d82/bd8/184shutterstock_1537552817__400.jpg)

Any idea on how to solve this issue in a clean way?

@boyardnicolas
Copy link
Author

Hello, thanks for the heads-up, I've already tried this (i.e FileHelper::isLocalPath($this->path, false)) but it doesn't work in my case, the pictures are generated but incorrectly linked ( https://domain.com/mnt/storage/staging/website/shared/storage/temp/public/164/cbf/0468__1920.jpeg instead of https://domain.com/storage/temp/public...).

In my case I have two levels of symlinks, current release served by NGINX from /mnt/storage/staging/website/current, which is a symlink to /mnt/storage/staging/website/releases/{latest_release}, this seems to be solved by your solution.
But then inside the project, the "storage" folder is also symlinked to a shared directory so that medias uploaded from back-office, framework and cms cache are kept across versions.

No time to dig further into that issue I'm afraid...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant