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

Explain how to use linkTo and generateFilePath to call an API #446

Closed
wants to merge 1 commit into from

Conversation

raphj
Copy link

@raphj raphj commented Jan 25, 2023

I spent a bit of time to understand why linkTo and generateFilePath would return /custom_apps/{appName}/path/to/api instead of /apps/{appName}/path/to/api on a Nextcloud instance running in Docker when used like this:

linkTo(appName, action)

This call worked on my Nextcloud instances because I don't use docker (to the app was installed in apps/) and the reverse proxy is set up such as index.php is not needed. The correct usage for API calls, as found in the code of other apps, is:

linkTo(appName, 'index.php') + '/' + action

There's a special case for files ending with ".php" in generateFilePath. I understand that generateFilePath is designed to link to static resources at /apps or /custom_files depending on where the app is installed, unless the file is a php file.

I'm not sure I documented this correctly, but to save other's people confusion, this should be pointed out. We might actually want to mention the .php special case and explain what I'm explaining somewhere, but I was not sure how to do it so feel free to edit my PR before merging.

Signed-off-by: raphj raphael.jakse@xwiki.com

Signed-off-by: raphj <raphael.jakse@xwiki.com>
Copy link
Contributor

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

👍

@raphj raphj closed this by deleting the head repository Apr 27, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants