nextcloud / officeonline

officeonline
46 stars 15 forks source link

Error for shared files - Could not find urlsrc in WOPI #210

Closed Mystikal57 closed 1 year ago

Mystikal57 commented 2 years ago

Hi,

Describe the bug We have 3 nextcloud servers. When i share a file from 1 server to another, and want to open the file on the second i have this error: "Could not find urlsrc in WOPI"

No problem with opening the local file

Expected behavior File should be open

Screenshots image

Client details:

Server details

Operating system: Ubuntu server 20.04

Web server: apache

Database: mysql 10.3.31

PHP version: 7.4.3

Nextcloud version: 22.1.1 & 21.0.4

Version of the officeonline app: 1.1.1 (same problem with 1.0.3)

Version of Office Online server : 16.0.10338.20039

Nextcloud log (data/nextcloud.log)

{"reqId":"Sbxgoa32HnvXRe5vhILP","level":0,"time":"2021-09-28T09:39:44+00:00","remoteAddr":"192.168.1.5","user":"user1","app":"files_sharing","method":"GET","url":"/index.php/apps/officeonline/index?fileId=27370&requesttoken=nYal98j9%2FrozLaDEdMe%2FcMsZDwAAnyGkIKAZL4IqHq4%3D%3A9MvWsrHPm8lkBpmuNqjIQKFoPmZy0VPCZ9lTHuVDTsQ%3D&path=%2Ftest_file%C3%A9%20(2).docx","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.4.1"}
{"reqId":"Sbxgoa32HnvXRe5vhILP","level":0,"time":"2021-09-28T09:39:44+00:00","remoteAddr":"192.168.1.5","user":"user1","app":"extract","method":"GET","url":"/index.php/apps/officeonline/index?fileId=27370&requesttoken=nYal98j9%2FrozLaDEdMe%2FcMsZDwAAnyGkIKAZL4IqHq4%3D%3A9MvWsrHPm8lkBpmuNqjIQKFoPmZy0VPCZ9lTHuVDTsQ%3D&path=%2Ftest_file%C3%A9%20(2).docx","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.4.1"}
{"reqId":"Sbxgoa32HnvXRe5vhILP","level":3,"time":"2021-09-28T09:39:44+00:00","remoteAddr":"192.168.1.5","user":"user1","app":"officeonline","method":"GET","url":"/index.php/apps/officeonline/index?fileId=27370&requesttoken=nYal98j9%2FrozLaDEdMe%2FcMsZDwAAnyGkIKAZL4IqHq4%3D%3A9MvWsrHPm8lkBpmuNqjIQKFoPmZy0VPCZ9lTHuVDTsQ%3D&path=%2Ftest_file%C3%A9%20(2).docx","message":{"Exception":"Exception","Message":"Could not find urlsrc in WOPI","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/officeonline/lib/TokenManager.php","line":208,"function":"getUrlSrcForFile","class":"OCA\\Officeonline\\WOPI\\Parser","type":"->"},{"file":"/var/www/nextcloud/apps/officeonline/lib/TokenManager.php","line":277,"function":"getToken","class":"OCA\\Officeonline\\TokenManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/officeonline/lib/Service/FederationService.php","line":138,"function":"getRemoteToken","class":"OCA\\Officeonline\\TokenManager","type":"->"},{"file":"/var/www/nextcloud/apps/officeonline/lib/Controller/DocumentController.php","line":238,"function":"getRemoteRedirectURL","class":"OCA\\Officeonline\\Service\\FederationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"index","class":"OCA\\Officeonline\\Controller\\DocumentController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/officeonline/lib/WOPI/Parser.php","Line":119,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.4.1"}
{"reqId":"Sbxgoa32HnvXRe5vhILP","level":0,"time":"2021-09-28T09:39:44+00:00","remoteAddr":"192.168.1.5","user":"user1","app":"scss_cacher","method":"GET","url":"/index.php/apps/officeonline/index?fileId=27370&requesttoken=nYal98j9%2FrozLaDEdMe%2FcMsZDwAAnyGkIKAZL4IqHq4%3D%3A9MvWsrHPm8lkBpmuNqjIQKFoPmZy0VPCZ9lTHuVDTsQ%3D&path=%2Ftest_file%C3%A9%20(2).docx","message":"SCSSCacher::process ordinary check follows","userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.4.1"}
{"reqId":"Sbxgoa32HnvXRe5vhILP","level":0,"time":"2021-09-28T09:39:44+00:00","remoteAddr":"192.168.1.5","user":"user1","app":"scss_cacher","method":"GET","url":"/index.php/apps/officeonline/index?fileId=27370&requesttoken=nYal98j9%2FrozLaDEdMe%2FcMsZDwAAnyGkIKAZL4IqHq4%3D%3A9MvWsrHPm8lkBpmuNqjIQKFoPmZy0VPCZ9lTHuVDTsQ%3D&path=%2Ftest_file%C3%A9%20(2).docx","message":"SCSSCacher::process ordinary check follows","userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.4.1"}
{"reqId":"Sbxgoa32HnvXRe5vhILP","level":0,"time":"2021-09-28T09:39:44+00:00","remoteAddr":"192.168.1.5","user":"user1","app":"scss_cacher","method":"GET","url":"/index.php/apps/officeonline/index?fileId=27370&requesttoken=nYal98j9%2FrozLaDEdMe%2FcMsZDwAAnyGkIKAZL4IqHq4%3D%3A9MvWsrHPm8lkBpmuNqjIQKFoPmZy0VPCZ9lTHuVDTsQ%3D&path=%2Ftest_file%C3%A9%20(2).docx","message":"SCSSCacher::process ordinary check follows","userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36","version":"21.0.4.1"}

Thank you

Mystikal57 commented 2 years ago

my troubleshoot: In TokenManager.php: file->getExtension():

file->getName():

Forced 'docx' for $file->getExtension() in Parser.php

Very interesting thing: image

Link found in network tracer, seems that the / is missing before index.php When i add the slash, it's working when not framed -> corrected in FederationService.php

One last thing: Refused to frame 'https://cloudremote.blabla.fr/' because it violates the following Content Security Policy directive: "frame-src 'self' https://oos.blabla.fr".

Added domain to EmptyContentSecurityPolicy.php -> everything works fine if (!empty($this->allowedFrameDomains)) { $policy .= 'frame-src '; $policy .= implode(' cloudremote.blabla.fr ', $this->allowedFrameDomains); $policy .= ';'; }

patschi commented 1 year ago

Due to its issue age and been a lot of changes since, closing this one. Please let us know if issues exist.