CADViewer / NextCloud

CAD viewing, markup and collaboration on NextCloud for AutoCAD, MicroStation and advanced raster graphics.
GNU Affero General Public License v3.0
23 stars 3 forks source link

NC 28.0.1 Cadviewer 9.40.6 - cadviewer breaks opening Office Documents #78

Closed sseide closed 8 months ago

sseide commented 9 months ago

We have installed the cadviewer plugin v9.40.6 as well as the "Nextcloud Office" plugin v8.3.1. We use a standalonce CODE server for Collabora Office, not the Built in Dev server.

As long as the Cadviewer plugin is enabled we cannot open office documents (ods, docx, xls, ...) anymore. Disabling the Cadviewer plugin office documents can be opened again and edited online.

Trying to open a office document with cadviewer enabled i see the following Error in the Browser Javascript console:

[INFO] viewer: Opening viewer for file  
Object { app: "viewer", uid: "me", level: "2", path: "/docs/somedoc.docx" }               viewer-main.js:2:2769
XHRPROPFIND
https://my.server.name/remote.php/dav/files/me/docs/somedoc.docx                          [HTTP/2 207 Multi-Status 89ms]
Could not open file /docs/somedoc.docx TypeError: t.replace is not a function             Viewer.vue:629
    replaceAll cadviewer_9.40.6.min.js:2
    I index.js:53
    I index.js:109
    $/< fileUtils.ts:66
    $ fileUtils.ts:57
    ie FileInfo.ts:62
    request CancelableRequest.js:41
    openFile Viewer.vue:620
    file Viewer.vue:456
    VueJS 11
    open Viewer.js:301
    Q FilesActionHandler.js:39
    execDefaultAction FileEntryActions.vue:197
    execDefaultAction FileEntry.vue:266
    VueJS 4
    click FileEntryName.vue:1
    VueJS 3

The problem (cannot open office documents) was also there with Cadviewer v.9.38.6. But i did not check if the same Javascript error was logged.

CADViewer commented 9 months ago

Hi @sseide , thanks, we will emulate and get back to you!

kevinkuan1969 commented 9 months ago

+1, Same here

lethargicpillow commented 8 months ago

Encountering the same problem. Also affects other file types.

CADViewer commented 8 months ago

Hi @sseide , @kevinkuan1969 , @lethargicpillow , we found a method overlap with NC28, in a code section where NC28 sets up paths for loading application files. We have rewritten code on our end, please test with new CADViewer v9.44.2 and provide feedback. Thanks!

sseide commented 8 months ago

Hello,

tested today with v9.44.2 / C28 and it seems to work again. Can open DXF, PDF, MD and Office files within Nextcloud Web-UI.

Only thing i had to do after the update was reloading the Nextcloud page (via Shift+F7). Bevor reloading and just after updateing and re-enabling the CadViewer Plugin the Office files were downloaded and not opened within Nextcloud. Something old cached browser-side it seems...

Thanks

kevinkuan1969 commented 8 months ago

Tested the below 8 files all failed with below error message. Also noted the files cannot be opened at the beginning after the app is upgraded and enabled. Started open after many clicks. image

image

kevinkuan1969 commented 8 months ago

** all the 8 files failed except jpg file.

sseide commented 8 months ago

sometimes i see this error too after upgrade to NextCloud - the Nextcloud updater removed the rewrite condition from the htaccess file.

Please check if the line - as stated in the install documentation - is inside your .htaccess file

RewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/*\.*
sseide commented 8 months ago

or some file access rights are not fitting anymore for the plugin. I create an smaller update script myself to fix the file access rights. This on i run whenever i see the error above to fix it. The rights named in the installation description are too open for my feelings...

cat cadviewer_permissions.sh

#!/bin/bash
#
# description from https://github.com/CADViewer/NextCloud
# supplied scipt assigns way to much rights
DIR=/var/www/nextcloud/apps/cadviewer
WWW_USER=www-data.www-data

cd "$DIR" || exit 1

pushd "converter/converters" || exit 1
# create tmp directories if not there
if [ ! -d files ]; then
       mkdir -p files
       chown "$WWW_USER" files
fi

# conversions
chmod a+x ax2024/linux/ax202*
chmod +w files
chmod +w files/merged
chmod +w files/print
chmod +w files/pdf
popd

pushd "converter" || exit 1
# redlines
chmod +w content/redlines
chmod +w content/redlines/v7

# php scripts
chmod +w php/call-Api_Conversion_log.txt
chmod +x php/call-Api_Conversion.php
chmod +x php/save-file.php

#chmod +x php/*.php
popd

# nextcloud updated removes rewrite condition from .htaccess file
# check if re-adding is needed:
HTACCESS_FILE=$(realpath ../../.htaccess)
HAS_REWRITE=$(grep "apps/cadviewer" "$HTACCESS_FILE" | wc -l)
if [ "$HAS_REWRITE" = "0" ]; then
    echo "Apache RewriteCond for CadViewer was removed from $HTACCESS_FILE"
    echo "Please add following line directly above 'RewriteRule . index.php [PT,E=PATH_INFO:$1]'"
    echo ""
    echo "RewriteCond %{REQUEST_FILENAME} !/apps/cadviewer/converter/php/*\.*"
fi