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

fix(JSResourceLocator): Consider configured app roots for files #43917

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Feb 29, 2024

Summary

#40898 introduced an issue when loading scripts from other app roots,
the problem is that the app roots are manually queried and then tried, but if the apps directory path is not a child of the server root the webroot could not be guessed.

The solution I propose is also simplifying the code I think:
Instead of looking into app roots after all other queries we load the app path and app webroot for the requested script in the beginning.
Then we try all paths like before, except for apps/... we now use {apppath}/... directly as this also works for the native apps root.
Here we also pass the matching app webroot so we do not need to fallback to the ResourceLocator guessing function.

Checklist

@susnux susnux added bug 3. to review Waiting for reviews labels Feb 29, 2024
@susnux susnux added this to the Nextcloud 29 milestone Feb 29, 2024
@susnux susnux requested review from juliusknorr, artonge, a team, nfebe and sorbaugh and removed request for a team February 29, 2024 16:34
$found += $this->appendScriptIfExist($this->serverroot, $theme_dir.$dirName.'/'.$script);
}
$found += $this->appendScriptIfExist($appRoot, $script, $appWebRoot);
$found += $this->appendScriptIfExist($this->serverroot, $theme_dir.'apps/'.$script);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug previously, because for all other scripts we always looked into themes/{themename}/apps/{appname}.
The mentioned PR broke this for translations that were now only searched in `themes/{themename}/{appswebroot}/{appname}.

@susnux
Copy link
Contributor Author

susnux commented Feb 29, 2024

/backport to stable28

@joergmschulz
Copy link

indeed - this seems to fix the issue

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish 3. to review Waiting for reviews and removed 3. to review Waiting for reviews 4. to release Ready to be released and/or waiting for tests to finish labels Mar 1, 2024
@susnux susnux merged commit 8d58356 into master Mar 7, 2024
160 checks passed
@susnux susnux deleted the fix/jsresourcelocator-apppath branch March 7, 2024 08:01
@blizzz blizzz mentioned this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
4 participants