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

[Bug]: File selector not working via the legacy API on NC28 #42291

Closed
5 of 8 tasks
paulijar opened this issue Dec 14, 2023 · 13 comments · Fixed by #43093
Closed
5 of 8 tasks

[Bug]: File selector not working via the legacy API on NC28 #42291

paulijar opened this issue Dec 14, 2023 · 13 comments · Fixed by #43093
Assignees

Comments

@paulijar
Copy link
Contributor

paulijar commented Dec 14, 2023

⚠️ This issue respects the following points: ⚠️

Bug description

When the Music app tries to open any file selection dialog (for example, to select the music library root path), this results in grey rectangles being shown in the dialog instead of file icons, names, and details. Errors are shown in the browser console:

PROPFIND https://<server>/remote.php/dav/files/<username>/                             [HTTP/1.1 404 Not Found 30ms]
Error: Invalid response: 404 Not Found

Edit: It's apparently necessary for this bug to happen to have a non-empty path in the root URL of the Nextcloud instance. So the bug doesn't happen when accessing the cloud instance on URL like https://my.cloud.host but it does happen when the URL is like https://my.cloud.host/nextcloud.

The same thing happens when the similar dialog is tried to be opened from the settings view of the AudioPlayer application.

image

The Music app uses the legacy API to show these dialogs. The API calls happen here: https://github.com/owncloud/music/blob/75efb45397bd06fcb17ae3f98fea68a2de15eef3/js/shared/dialogs.ts#L26-L34

These dialogs used to work fine on NC 27.1.2, but the problem is present on NC 28.0.0 (and also on its RC2 and RC4, at least). Note that Music and AudioPlayer apps don't yet have compatible versions for NC28, but that shouldn't be relevant for this issue; the old versions work enough to run into this problem scenario.

Steps to reproduce

  1. Install and enable the Music app
  2. Open the app and navigate to the Settings view
  3. Click on the "Path to your music collection"

Expected behavior

The folder selection dialog opens and can be used to select a folder.

Installation method

Other Community project

Nextcloud Server version

28

Operating system

Other

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

SQlite

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "sqlite3",
        "version": "28.0.0.11",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***/nextcloud-28",
        "installed": true,
        "app_install_overwrite": [
            "music",
            "spreed"
        ],
        "loglevel": 2,
        "maintenance": false
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - audioplayer: 3.4.1
  - circles: 28.0.0-dev
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contactsinteraction: 1.9.0
  - dashboard: 7.8.0
  - dav: 1.29.1
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_external: 1.20.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - music: 1.9.1
  - nextcloud_announcements: 1.17.0
  - notes: 4.9.0
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - photos: 2.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.0
  - sharebymail: 1.18.0
  - support: 1.11.0
  - survey_client: 1.16.0
  - systemtags: 1.18.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0
  - bruteforcesettings: 2.8.0
  - encryption: 2.16.0
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2
  - user_ldap: 1.19.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

(nothing logged by running the case)

Additional info

Console output:

XHRPROPFIND
https://<server>/remote.php/dav/files/<username>/
[HTTP/1.1 404 Not Found 16ms]

XHRPROPFIND
https://<server>/remote.php/dav/files/<username>/
[HTTP/1.1 404 Not Found 32ms]

Error: Invalid response: 404 Not Found
    pt index.js:2
    mt index.js:2
    Xt index.js:2
    promise callback*Kt index.js:2
    Xt index.js:2
    Xt index.js:2
    getDirectoryContents index.js:2
    a FilePicker-0bd54f66.mjs:835
    <anonymous> FilePicker-0bd54f66.mjs:843
    VueJS 13
    pick index.mjs:30
    pick index.mjs:56
    pick index.mjs:55
    filepicker dialogs.js:360
    value webpack.app.d60dd09a426eacdae140.js:2
    value webpack.app.d60dd09a426eacdae140.js:2
    selectPath webpack.app.d60dd09a426eacdae140.js:2
    recurse webpack.app.d60dd09a426eacdae140.js:2
    i webpack.app.d60dd09a426eacdae140.js:2
    $eval webpack.app.d60dd09a426eacdae140.js:2
    $apply webpack.app.d60dd09a426eacdae140.js:2
    compile webpack.app.d60dd09a426eacdae140.js:2
    dispatch webpack.app.d60dd09a426eacdae140.js:2
    handle webpack.app.d60dd09a426eacdae140.js:2
    add webpack.app.d60dd09a426eacdae140.js:2
    i webpack.app.d60dd09a426eacdae140.js:2
    each webpack.app.d60dd09a426eacdae140.js:2
    each webpack.app.d60dd09a426eacdae140.js:2
    f webpack.app.d60dd09a426eacdae140.js:2
    on webpack.app.d60dd09a426eacdae140.js:2
    compile webpack.app.d60dd09a426eacdae140.js:2
    pe webpack.app.d60dd09a426eacdae140.js:2
    Me webpack.app.d60dd09a426eacdae140.js:2
    se webpack.app.d60dd09a426eacdae140.js:2
    oe webpack.app.d60dd09a426eacdae140.js:2
    oe webpack.app.d60dd09a426eacdae140.js:2
    se webpack.app.d60dd09a426eacdae140.js:2
    oe webpack.app.d60dd09a426eacdae140.js:2
    ae webpack.app.d60dd09a426eacdae140.js:2
    link webpack.app.d60dd09a426eacdae140.js:2
    pe webpack.app.d60dd09a426eacdae140.js:2
    Me webpack.app.d60dd09a426eacdae140.js:2
    se webpack.app.d60dd09a426eacdae140.js:2
[vue.runtime.esm.js:3049:16](webpack:///nextcloud/node_modules/vue/dist/vue.runtime.esm.js)
Error: Invalid response: 404 Not Found
    pt index.js:2
    mt index.js:2
    Xt index.js:2
    promise callback*Kt index.js:2
    Xt index.js:2
    Xt index.js:2
    getDirectoryContents index.js:2
    a FilePicker-0bd54f66.mjs:835
    setup FilePicker-0bd54f66.mjs:927
    VueJS 13
    pick index.mjs:30
    pick index.mjs:56
    pick index.mjs:55
    filepicker dialogs.js:360
    value webpack.app.d60dd09a426eacdae140.js:2
    value webpack.app.d60dd09a426eacdae140.js:2
    selectPath webpack.app.d60dd09a426eacdae140.js:2
    recurse webpack.app.d60dd09a426eacdae140.js:2
    i webpack.app.d60dd09a426eacdae140.js:2
    $eval webpack.app.d60dd09a426eacdae140.js:2
    $apply webpack.app.d60dd09a426eacdae140.js:2
    compile webpack.app.d60dd09a426eacdae140.js:2
    dispatch webpack.app.d60dd09a426eacdae140.js:2
    handle webpack.app.d60dd09a426eacdae140.js:2
    add webpack.app.d60dd09a426eacdae140.js:2
    i webpack.app.d60dd09a426eacdae140.js:2
    each webpack.app.d60dd09a426eacdae140.js:2
    each webpack.app.d60dd09a426eacdae140.js:2
    f webpack.app.d60dd09a426eacdae140.js:2
    on webpack.app.d60dd09a426eacdae140.js:2
    compile webpack.app.d60dd09a426eacdae140.js:2
    pe webpack.app.d60dd09a426eacdae140.js:2
    Me webpack.app.d60dd09a426eacdae140.js:2
    se webpack.app.d60dd09a426eacdae140.js:2
    oe webpack.app.d60dd09a426eacdae140.js:2
    oe webpack.app.d60dd09a426eacdae140.js:2
    se webpack.app.d60dd09a426eacdae140.js:2
    oe webpack.app.d60dd09a426eacdae140.js:2
    ae webpack.app.d60dd09a426eacdae140.js:2
    link webpack.app.d60dd09a426eacdae140.js:2
    pe webpack.app.d60dd09a426eacdae140.js:2
    Me webpack.app.d60dd09a426eacdae140.js:2
    se webpack.app.d60dd09a426eacdae140.js:2
@paulijar paulijar added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Dec 14, 2023
@paulijar
Copy link
Contributor Author

At least part of the problem is that the dialog is trying to fetch the resource
https://<server>/remote.php/dav/files/<username>/
while the correct address for this server would be
https://<server>/nextcloud-28/remote.php/dav/files/<username>/

@tflidd
Copy link
Contributor

tflidd commented Dec 24, 2023

When using Nextcloud inside a subfolder, I used to set the overwritewebroot as well:

https://github.com/nextcloud/server/blob/master/config/config.sample.php#L601C1-L609C1

Perhaps this already fixes the wrong URL...

@paulijar
Copy link
Contributor Author

I just tested adding the overwritewebroot conf but it didn't change anything regarding this issue.

@paulijar
Copy link
Contributor Author

I did some debugging on this and found out something interesting:
When the web page is loaded, the function getRootUrl() gets called while the window.OC is still undefined. Hence, it returns an empty string instead of the correct root URL. I then made an experiment where I had a break point on that function, and on the first hit to that break point, I executed the following on the browser console:

window.OC = {webroot: '/nextcloud-28'}

After this, the file selector dialog started to work as intended!

So I think we have the root cause here, but I still don't know, how this should be properly fixed. But maybe someone with better understanding of the details of @nextcloud/dialogs and @nextcloud/router can use this insight to create a fix.

@skjnldsv
Copy link
Member

Is this not an issue with the dialog library?

@susnux
Copy link
Contributor

susnux commented Jan 24, 2024

I think I know whats going on here after debugging, its a execution order issue:

  1. OC/index.js is loaded
  2. It loads xhr-error.js
  3. xhr-error.js (BTW that has a cyclic dependency on OC/index.js)
  4. that then loads: notification.js
  5. that needs @nextcloud/dialogs
  6. Which then needs @nextcloud/l10n/gettext for its translations
  7. Which needs @nextcloud/router

So the problem is our libraries are used within the init of the global OC.
This is a problem because our libraries itself depend on window.OC.

The solution would be to make our libraries independent from window.OC and directly use the private _oc_webroots (and similiar) variable in the libraries.


❗ EDIT: But this does not cause the error, the problem is:
davRemotePath is initialized before OC.webroot is, due to OC/util.js is loaded (which uses @nextcloud/files) before OC/webroot.js.

@susnux susnux added 3. to review Waiting for reviews and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jan 24, 2024
@susnux susnux self-assigned this Jan 24, 2024
@paulijar
Copy link
Contributor Author

Thanks! Works fine now on NC 28.0.2 RC4.

@paulijar
Copy link
Contributor Author

This problem was already fixed once but now it's back in NC29-RC1.

@paulijar paulijar reopened this Mar 28, 2024
paulijar added a commit to owncloud/music that referenced this issue Mar 28, 2024
The base class OC\BackgroundJob\TimedJob has been removed in NC29 in
favor of OCP\BackgorundJob\TimedJob. However, the new alternative is
not available on ownCloud and we now need to dynamically select among
these two the one which can be found.

Also, marked the app now as compatible with NC29 as it seemed to work
fine on NC29-RC1. Except for the Nextcloud  files dialog issue
nextcloud/server#42291 which has made a
come-back, after being already fixed in NC28.0.2. [sigh]

refs #1132
@skjnldsv
Copy link
Member

@paulijar is that the same symptoms?
It's odd that it's suddenly back 🤔

@paulijar
Copy link
Contributor Author

Yes, looks exactly the same, and the browser console shows that NC tries to fetch https://<domain>/remote.php/dav/files/<username>/ which is a wrong address as it's missing the server path.

@paulijar
Copy link
Contributor Author

But what's interesting is that this problem is not present on NC29-beta3. So something has gone wrong very recently.

@susnux
Copy link
Contributor

susnux commented Mar 29, 2024

Seems to be fixed when releasing a new dialogs versions, might be related to different @nextcloud/router versions.
Will release a new version next week and see if it is fixed for 29.rc2

@paulijar
Copy link
Contributor Author

paulijar commented Apr 6, 2024

This is working fine again in NC29-rc2.

@paulijar paulijar closed this as completed Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants