Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Error when updating to Nova 2.7 - Trix was updated. #44

Closed
muckypuddle-nick opened this issue Nov 13, 2019 · 5 comments
Closed

Error when updating to Nova 2.7 - Trix was updated. #44

muckypuddle-nick opened this issue Nov 13, 2019 · 5 comments

Comments

@muckypuddle-nick
Copy link

muckypuddle-nick commented Nov 13, 2019

When trying to upgrade to Nova 2.7 I got some errors on the Froala Field, related to the parameters of withFiles.

Since the froala field is extending the \vendor\laravel\nova\src\Fields\Trix.php field, you should be aware in the the most recent versions of Nova( tested with 2.7), the withFiles method has a $path parameter.

Trix.php - withFiles function on 2.7

public function withFiles($disk = null, $path = '/')
    {
        $this->withFiles = true;

        $this->disk($disk)->path($path);

        $this->attach(new StorePendingAttachment($this))
             ->detach(new DetachAttachment($this))
             ->delete(new DeleteAttachments($this))
             ->discard(new DiscardPendingAttachments($this))
             ->prunable();

        return $this;
    }

Trix.php - withFiles function on 2.5

    public function withFiles($disk = null)
    {
        $this->withFiles = true;

        $this->disk($disk);

        $this->attach(new StorePendingAttachment($this))
             ->detach(new DetachAttachment($this))
             ->delete(new DeleteAttachments($this))
             ->discard(new DiscardPendingAttachments($this))
             ->prunable();

        return $this;
    }

Adding the parameter to the Froala.php 's withFiles method seems to work just fine locally.

For people that hit that issue, revert to a previous version of Nova until this is fixed.

@sytheveenje
Copy link
Contributor

sytheveenje commented Nov 13, 2019

Having the same issue.

The fix is to change line 106 in Froala.php from:
public function withFiles($disk = null)
to
public function withFiles($disk = null, $path = '/')

@muckypuddle-nick
Copy link
Author

Hi @sytheveenje,

Yeap, that works as stated, but as I didn't dig in the Froala field code further, I don't know what implications may arise from that change. Still would suggest downgrading nova and wait for most people.

Best,
Nick

@sinnbeck
Copy link

Yeah changing vendor packages directly is bad as they are not under version control. Once you push to live, it will break again :) Instead you could clone it, fix it and use that version instead. Or better yet, make a pull request

@sytheveenje
Copy link
Contributor

I understand @chatzisnik. Didn't saw your fix in your post.

I'll wait for the fix.

@slavarazum
Copy link
Collaborator

Fiexed in 3.2.1

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

No branches or pull requests

4 participants