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

App not loading when accessed without trailing / #765

Closed
memen45 opened this issue Jun 3, 2020 · 4 comments
Closed

App not loading when accessed without trailing / #765

memen45 opened this issue Jun 3, 2020 · 4 comments
Labels

Comments

@memen45
Copy link

memen45 commented Jun 3, 2020

When the app is accessed by the url "https://example.nextcloud.com/apps/music", the app keeps loading without finishing and the following appears in the console:

Error: "Response for getList SHOULD be an array and not an object or something else"
Angular 7
Possibly unhandled rejection: {}

Also, the url is now showing "https://example.nextcloud.com/apps/music#/".

When the app is accessed with the first url, but including a trailing "/", everything works fine. All other apps in nextcloud work fine either with or without trailing "/".

@paulijar paulijar added the Bug label Jun 3, 2020
@paulijar
Copy link
Collaborator

paulijar commented Jun 3, 2020

I actually noticed this myself just recently. I did some testing but couldn't find out a way to fix it. If I remember correctly, I managed to make some hack which would have solved the situation on Firefox but it did not work on Chrome. Any good ideas are welcome :).

@memen45
Copy link
Author

memen45 commented Jun 4, 2020

This is where the error comes from:

throw new Error('Response for getList SHOULD be an array and not an object or something else');

I checked the network tab and I see a problem here:

Without trailing "/":

apps/api/prepare_collection

With trailing "/":

apps/music/api/prepare_collection

It seems that the request url is not created correctly and the part after the last "/" is omitted and then appended with api/prepare_collection.

@paulijar
Copy link
Collaborator

paulijar commented Jun 5, 2020

Thanks for digging. I did notice earlier that the API calls were malformed. But what I didn't realize was that this was in fact the only problem. I thought that the routing of the AngularJS page would be broken when the address looked like "https://example.nextcloud.com/apps/music#/", and I tried to use redirection to make it look like "https://example.nextcloud.com/apps/music/#/". But this was a false assumption, in fact it doesn't matter that the address looks funny. The only important thing is that the base address of the RESTAngular library has to be set properly, to enable correctly formed API calls.

I still need to work out some details on how to set the base address so that it certainly works on all kinds of server configurations. But this shouldn't be a major obstacle, so the issue should get fixed for the next Music app release.

paulijar added a commit that referenced this issue Jun 5, 2020
If there was no trailing slash, the RESTAngular library assumed that
the last part in the URL 'music' was not part of the base URL. When we
then changed the base URL for RESTAngular using relative path 'api', it
ended up to be like
'<serve_domain>/nextcloud/index.php/apps/api' instead of
'<serve_domain>/nextcloud/index.php/apps/music/api'.

Fixed by setting the complete path to RESTAngular, e.g.
`/nextcloud/index.php/apps/music/api`.

refs #765
@paulijar
Copy link
Collaborator

This has been fixed in the Music app release v0.15.0.

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

No branches or pull requests

2 participants