+2

error with weblink edit by OnlyOffice

Gerald F 2 years ago updated by Matt V 2 years ago 3

Dear Vlad,

There is a bug in the OnlyOffice module when you use it in edit mode via a weblink.

Onlyoffice returns a message : 'impossible to save the document'.


The problem is that the variable callbackUrl not have id_rnd.

By adding the following code after line 72 to

customizables/plugins/app.php

$weblinkInfo = $this->data['weblink']['linkInfo'];

it solves the problem of the link without id_rnd, but

as it's not a system weblink the application returns a message 'Invalid link type!'

to the callbackUrl of a json expected by OnlyOffice.

Moreover, when you configure a web link to use onlyOffice in preview mode, it still launches in edit mode

I don't know how this is fixed.

Thanks for your help.

G.

Can confirm, I have the same issue.

Same here. Filerun version 2021.03.26.

ONLYOFFICE error in /var/log/onlyoffice/documentserver/docservice/out.log-20210507 is the following:

[2021-05-10T10:45:37.990] [ERROR] nodeJS - error parseReplyData: docId = 1148--1620663555; data = Invalid link id.
SyntaxError: Unexpected token I in JSON at position 0
at JSON.parse ()
at parseReplyData (/snapshot/server/build/server/DocService/sources/DocsCoServer.js:0:0)
at onReplySendStatusDocument (/snapshot/server/build/server/DocService/sources/DocsCoServer.js:0:0)
at onReplySendStatusDocument.next ()
at sendStatusDocument (/snapshot/server/build/server/DocService/sources/DocsCoServer.js:0:0)
at sendStatusDocument.next ()
at endAuth (/snapshot/server/build/server/DocService/sources/DocsCoServer.js:0:0)
at endAuth.next ()
at auth (/snapshot/server/build/server/DocService/sources/DocsCoServer.js:0:0)
at auth.next ()
at /snapshot/server/build/server/DocService/sources/DocsCoServer.js:0:0
at Generator.next ()
at onFulfilled (/snapshot/server/build/server/DocService/node_modules/co/index.js:65:19)
at process._tickCallback (internal/process/next_tick.js:68:7)

EDIT: I think I found a workable solution. I added the following line to [filerun webroot]/customizables/plugins/onlyoffice/app.php after line 91:

$weblinkInfo = WebLinks::createForService($this->data);

So [filerun webroot]/customizables/plugins/onlyoffice/app.php looks like the following after the edit:

if (\FileRun\Perms::check('upload')) {
    if ((!$this->data['shareInfo'] || ($this->data['shareInfo'] && $this->data['shareInfo']['perms_upload']))) {
        $weblinkInfo = WebLinks::createForService($this->data); #This is the added line
        $saveURL = WebLinks::getSaveURL($weblinkInfo['id_rnd'], false, "onlyoffice");
        if (in_array($extension, $this->canEditTypes)) {
            $mode = 'edit';
        }
    }
}

All,

Looks like Vlad and his team have fixed this issue in the latest FileRun update. For now, here's the updated /customizables/plugins/onlyoffice/app.php file, simply replace the existing one in

[filerun webroot]/customizables/plugins/onlyoffice/

and the weblink editing functionality will work with ONLYOFFICE.

app.php