nextcloud-keeweb icon indicating copy to clipboard operation
nextcloud-keeweb copied to clipboard

KeeWeb breaks Activity view in Nextcloud 19.0.2

Open an-schall opened this issue 4 years ago • 12 comments

Hi,

I just installed KeeWeb from the “App Store” and now when opening the activity tab inside Nextcloud, it is not loaded but the “circling”-icon is shown.

The logs says:

[no app in context] Error: Exception: substr() expects parameter 3 to be int, bool given at <>

    /var/www/nextcloud/lib/private/AppFramework/App.php line 137
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Activity\Controller\APIv2 {}, “getFilter”)
    /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main(“APIv2Controller”, “getFilter”, OC\AppFramework\ … {}, {filter: “self”, … "})
    <>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({filter: “self”, … "})
    /var/www/nextcloud/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ … {}, {filter: “self”, … "})
    /var/www/nextcloud/ocs/v1.php line 88
    OC\Route\Router->match("/ocsapp/apps/ac … f")
    /var/www/nextcloud/ocs/v2.php line 24
    require_once("/var/www/nextcloud/ocs/v1.php")

GET /ocs/v2.php/apps/activity/api/v2/activity/self?format=json&previews=true&since=0
from xxx.xx.xx.20 by user at 2020-09-02T13:25:19+00:00

an-schall avatar Sep 02 '20 13:09 an-schall

The version in the App Store is not released yet for Nextcloud 19. Did you use the beta version of Keeweb?

arnowelzel avatar Sep 02 '20 13:09 arnowelzel

I can reproduce the issue on my prod instance

Opening activity app with my user does not finish loading and give an error in the log. It works with other users.

But this seems to be due to the MindMaps Plugin. Are you sure this is a bug from NC-Keeweb? I think it is from a shared MindMap somehow. Might be that shared kdbx files are producing the same issue.

Verursacht durchTypeError: substr() expects parameter 3 to be int, bool given
    /var/www/html/lib/private/Files/Type/Detection.php - line 376:
    substr("mindmap", 0, false)
    /var/www/html/apps/activity/lib/Controller/APIv2.php - line 408:
    OC\Files\Type\Detection->mimeTypeIcon("mindmap")
    /var/www/html/apps/activity/lib/Controller/APIv2.php - line 388:
    OCA\Activity\Controller\APIv2->getPreviewPathFromMimeType("application/km")
    /var/www/html/apps/activity/lib/Controller/APIv2.php - line 304:
    OCA\Activity\Controller\APIv2->getPreview("user", 186326, "/MindMaps/Test.km")
    /var/www/html/apps/activity/lib/Controller/APIv2.php - line 209:
    OCA\Activity\Controller\APIv2->get("files_sharing", 0, 50, true, "", 0, "desc")
    /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 170:
    OCA\Activity\Controller\APIv2->getFilter("files_sharing", 0, 50, true, "", 0, "desc")
    /var/www/html/lib/private/AppFramework/Http/Dispatcher.php - line 100:
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Activity ... {}, "getFilter")
    /var/www/html/lib/private/AppFramework/App.php - line 137:
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Activity ... {}, "getFilter")
    /var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:
    OC\AppFramework\App::main("APIv2Controller", "getFilter", OC\AppFramew ... {}, { filter: "f ... "})
    <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({ filter: "f ... "})
    /var/www/html/lib/private/Route/Router.php - line 297:
    call_user_func(OC\AppFramew ... {}, { filter: "f ... "})
    /var/www/html/ocs/v1.php - line 88:
    OC\Route\Router->match("/ocsapp/app ... g")
    /var/www/html/ocs/v2.php - line 24:
    require_once("/var/www/html/ocs/v1.php")

maurerle avatar Sep 02 '20 14:09 maurerle

I could reproduce it by using a different user on my instance and after sharing a Mindmap link with it, it takes forever to finish loading activity app.

I could not reproduce on a fresh install by installing keeweb, installing mindmap, opening mindmap, sharing mindmap, sharing kdbx file or whatever. Tested on NC 18 and 19 with 0.6.3.

I could fix it by deactivting Keeweb (0.6.3) And Mind Map (0.0.22) and activating first keeweb and then Mind Map again (don't know if order is relevant)

maurerle avatar Sep 02 '20 14:09 maurerle

JFTR: I remember MindMap as an application which caused some issues in the past for at least one of my customers. So it may be that this app still has some issues.

arnowelzel avatar Sep 02 '20 15:09 arnowelzel

I used 0.6.2 from the App store.

I am rather sure it is connected to KeeWeb as this happened right after installing KeeWeb and the error in the log files goes one, mentioning KeeWeb:

Caused by TypeError: substr() expects parameter 3 to be int, bool given

/var/www/nextcloud/lib/private/Files/Type/Detection.php - line 376:

substr("keeweb", 0, false)

/var/www/nextcloud/apps/activity/lib/Controller/APIv2.php - line 408:

OC\Files\Type\Detection->mimeTypeIcon("**keeweb**")

/var/www/nextcloud/apps/activity/lib/Controller/APIv2.php - line 388:

OCA\Activity\Controller\APIv2->getPreviewPathFromMimeType("**application/x-kdbx**")

/var/www/nextcloud/apps/activity/lib/Controller/APIv2.php - line 304:

OCA\Activity\Controller\APIv2->getPreview("user", 64092, "/foo/bar ... x")

/var/www/nextcloud/apps/activity/lib/Controller/APIv2.php - line 209:

OCA\Activity\Controller\APIv2->get("all", 0, 50, true, "", 0, "desc")

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 170:

OCA\Activity\Controller\APIv2->getFilter("all", 0, 50, true, "", 0, "desc")

/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

OC\AppFramework\Http\Dispatcher->executeController(OCA\Activity ... {}, "getFilter")

/var/www/nextcloud/lib/private/AppFramework/App.php - line 137:

OC\AppFramework\Http\Dispatcher->dispatch(OCA\Activity ... {}, "getFilter")

/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

OC\AppFramework\App::main("APIv2Controller", "getFilter", OC\AppFramew ... {}, { filter: "a ... "})

<<closure>>

OC\AppFramework\Routing\RouteActionHandler->__invoke({ filter: "a ... "})

/var/www/nextcloud/lib/private/Route/Router.php - line 297:

call_user_func(OC\AppFramew ... {}, { filter: "a ... "})

/var/www/nextcloud/ocs/v1.php - line 88:

OC\Route\Router->match("/ocsapp/app ... l")

/var/www/nextcloud/ocs/v2.php - line 24:

require_once("/var/www/nextcloud/ocs/v1.php")

an-schall avatar Sep 03 '20 11:09 an-schall

The interesting question here is - why does a component of Nextcloud (not Keeweb) use a function in the wrong way?

/var/www/nextcloud/lib/private/Files/Type/Detection.php - line 376:

substr("keeweb", 0, false)

So the code around here is:

		// Icon exists?
		try {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg');
			return $this->mimetypeIcons[$mimetype];
		} catch (\RuntimeException $e) {
			// Specified image not found
		}

		// Try only the first part of the filetype
		$mimePart = substr($icon, 0, strpos($icon, '-'));
		try {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg');
			return $this->mimetypeIcons[$mimetype];
		} catch (\RuntimeException $e) {
			// Image for the first part of the mimetype not found
		}

		$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.svg');
		return $this->mimetypeIcons[$mimetype];

Ok, it seems to have to do with the mimeType registration of Keeweb.

$mimePart = substr($icon, 0, strpos($icon, '-'));

What if $icon does not contain -? The source is this in the same method:

		// Replace slash and backslash with a minus
		$icon = str_replace(['/', '\\'], '-', $mimetype);

So the mimetype is expected to have one slash or backslash. I think we need to debug this code to find out exactly what is going on here and why the mimeType of Keeweb seems to something in the wrong format.

JFTR: Keeweb 0.6.3 beta works fine for me in NC 19 - so there are setups which work and I'm not sure yet if this might be an upstream problem.

arnowelzel avatar Sep 03 '20 11:09 arnowelzel

@an-schall have you tried disabling and enabling the app? ;)

maurerle avatar Sep 03 '20 12:09 maurerle

@maurerle: The Windows-based approach doesn't work for me and results in the same bug. :)

A question out of ignorance: From where is the beta version accessible?

an-schall avatar Sep 03 '20 15:09 an-schall

It is a little bit hidden, but you can find it here with install instructions: https://github.com/jhass/nextcloud-keeweb/issues/154#issuecomment-683694391

maurerle avatar Sep 03 '20 15:09 maurerle

Thanks, I just tried and 0.6.3. breaks Nextcloud 19.0.2 in the same way as described initially.

an-schall avatar Sep 03 '20 15:09 an-schall

I use 0.6.3 with Nextcloud 19.0.3 without any issue and I can't reproduce this problem, sorry.

arnowelzel avatar Sep 19 '20 14:09 arnowelzel

We had an update to Keewen 0.6.4 recently and it works fine with NC 20.0.3 on my productin server as well as on my development system. Can you please check, if this version works better for you? Is the problem still present?

arnowelzel avatar Dec 14 '20 01:12 arnowelzel