FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
177 stars 96 forks source link

if the assets/files is a link, the returned path will be the linked file path #172

Closed lubobill1990 closed 4 years ago

lubobill1990 commented 5 years ago

https://github.com/flagrow/upload/blob/4e6fb47ce01f1a6f3592dec3d5904570cdbba07b/src/Adapters/Local.php#L31

if the assets/files is a link to another location, the returned path will be the linked file path

This happens because in league/flysystem: League\Flysystem\Adapter\Local

    public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = [])
    {
        $root = is_link($root) ? realpath($root) : $root;
        $this->permissionMap = array_replace_recursive(static::$permissions, $permissions);
        $this->ensureDirectory($root);

        if ( ! is_dir($root) || ! is_readable($root)) {
            throw new LogicException('The root path ' . $root . ' is not readable.');
        }

But it's very common to make the asset/files a link to a NFS disk in production environment.

rob006 commented 5 years ago

But it's very common to make the asset/files a link to a NFS disk in production environment.

And what is the problem with that?

lubobill1990 commented 5 years ago

@rob006 The problem is, when public/assets/files is a symbolic link to another path, for example the path is /var/nfs, the path of the uploaded file tag in the post will be like

[upl-image-preview url=https://xxxx.com/var/nfs/2019-03-29/1553845125-8

lubobill1990 commented 5 years ago

any progress on this issue and the related pull request?

clarkwinkelmann commented 4 years ago

I see a PR has been merged. Is there anything else we have forgotten to follow up on ? Let us know and we'll re-open the issue

lubobill1990 commented 4 years ago

Yes, the PR has been merged in June 2019.