Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13.0.5.2: multiple app_paths entries trigger "ResourceLocator can not find a web root" #10437

Closed
hefee opened this issue Jul 29, 2018 · 3 comments

Comments

@hefee
Copy link

hefee commented Jul 29, 2018

When having multiple apps_paths configured, nextcloud can't locate some files in the app2 directory (for spreed, contacts, calendar).

is the normal nextcloud webroot dir where all files from the tarball are located. is outside the nextcloud webroot dir. If I move the apps2 dir inside than the whole works without any issue.

here part of the config.php:

'apps_paths' =>
array (
  0 =>
  array (
    'path' => '<base>/apps',
    'url' => '/apps',
    'writable' => false,
  ),
  1 =>
array (
    'path' => '<otherdir>/apps2',
    'url' => '/apps2',
    'writable' => true,
  ),
),

If accessing an app from app2 store I see following in nextcloud.log:
{"reqId":"rzO1sbIASisnFsOLxDxT","level":3,"time":"2018-07-29T14:34:08+02:00","remoteAddr":"2001:16b8:55eb:9efc:9f6:65a0:6b43:862b","user":"XXX","app":"lib","method":"GET","url":"\/index.php\/apps\/spreed\/","message":"ResourceLocator can not find a web root (root: <otherdir>\/apps2\/spreed, file: index.php\/css\/spreed\/93dd-bdec-autocomplete.css, webRoot: , throw: true)","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:52.0) Gecko\/20100101 Firefox\/52.0","version":"13.0.5.2"}

As the app2 dir is not inside ResourceLocator->mapping.

I think the correct solution would be to add the app_paths and urls to the intialization of ResourceLocator. Only in lib/private/TemplateLayout.php the classes CSSresourceLocator and JSResourceLocator are used.

https://github.com/nextcloud/server/blob/master/lib/private/TemplateLayout.php#L277

My first guess/workaround is to replace this with a dict with all apps root ala:

$dirs = array( \OC::$SERVERROOT => \OC::$WEBROOT);
foreach (\OC::$APPSROOTS as $dir) {
   $dirs[$dir['path']] = $dir['url'];
}
$locator = new \OC\Template\CSSResourceLocator(
		\OC::$server->getLogger(),
		$theme,
		$dirs,
		$dirs,
		$SCSSCacher
	);

but as I'm not familiar with the nextcloud so it may be the wrong place to fix this, another option is to add the foreach loop to ResourceLocator...

With nextcloud 12 I solved the issue by adding a symbolc link to /apps2, but CSSResourceLocator now using realpath so this won't work.

https://github.com/nextcloud/server/blob/master/lib/private/Template/CSSResourceLocator.php#L82

This may related/fix #5289, Wonderfall/dockerfiles#264

Operating system:
Debian, stable 9.5

Web server:
ngnix

Database:
postgres

PHP version:
7.0.30

Nextcloud version: (see Nextcloud admin page)
13.0.5.2

@Dreamsorcerer
Copy link
Contributor

I'm seeing the same errors on my site. Though, strangely, looking at it in the browser, the mentioned CSS files are loaded successfully despite these errors.

The Talk app also seems to remain broken, even if I manually fix the code to stop the errors occurring (while the contacts app works regardless of the errors).

@ThaDaVos
Copy link

I'm running the snap version of nextcloud 14.0.3 and I'm still seeing these errors in my logs - is there any fix?

@hefee
Copy link
Author

hefee commented Jan 15, 2019

With 15.0.2 I don't get the error itself anymore. Just the message is still written to errorlog, like nextcloud-snap/nextcloud-snap#402 (comment):

ResourceLocator can not find a web root (root: <pathto>/apps2/calendar, file: index.php/css/calendar/e34c-4cfe-app.min.css, webRoot: , throw: true)

That's why I would close this bug.

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

No branches or pull requests

3 participants