nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.69k stars 4k forks source link

[Bug]: File picker is broken in user settings #46325

Open StefInP opened 2 months ago

StefInP commented 2 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

In user settings, when you want to select the default folder to accepted shares, the file picker opens but doesn't display the list of folders. Impossible to select one.

Steps to reproduce

  1. Go to user settings
  2. Try to select a default folder for accepted shared image

Expected behavior

File picket should display the list of folders.

Installation method

Official All-in-One appliance

Nextcloud Server version

29

Operating system

Linux 5.10.55+ aarch64 (NAS Synology)

PHP engine version

PHP 8.2

Web server

None

Database engine version

PostgreSQL

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

Updated from a MINOR version (ex. 28.0.1 to 28.0.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{ "system": { "one-click-instance": true, "one-click-instance.user-limit": 100, "memcache.local": "\OC\Memcache\APCu", "apps_paths": [ { "path": "\/var\/www\/html\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/html\/custom_apps", "url": "\/custom_apps", "writable": true } ], "appsallowlist": false, "check_data_directory_permissions": false, "memcache.distributed": "\OC\Memcache\Redis", "memcache.locking": "\OC\Memcache\Redis", "redis": { "host": "REMOVED SENSITIVE VALUE", "password": "REMOVED SENSITIVE VALUE", "port": 6379 }, "overwritehost": "**.fr", "overwriteprotocol": "https", "passwordsalt": "REMOVED SENSITIVE VALUE", "secret": "REMOVED SENSITIVE VALUE", "trusteddomains": [ "localhost", "**.fr" ], "datadirectory": "REMOVED SENSITIVE VALUE", "dbtype": "pgsql", "version": "29.0.3.4", "overwrite.cli.url": "https:\/\/**.fr\/", "dbname": "REMOVED SENSITIVE VALUE", "dbhost": "REMOVED SENSITIVE VALUE", "dbport": "", "dbtableprefix": "oc", "dbuser": "REMOVED SENSITIVE VALUE", "dbpassword": "REMOVED SENSITIVE VALUE", "installed": true, "instanceid": "REMOVED SENSITIVE VALUE", "maintenance": false, "updatedirectory": "\/nc-updater", "loglevel": 2, "log_type": "file", "logfile": "\/var\/www\/html\/data\/nextcloud.log", "log_rotate_size": "10485760", "log.condition": { "apps": [ "admin_audit" ] }, "preview_max_x": 2048, "preview_max_y": 2048, "jpeg_quality": 60, "enabledPreviewProviders": [ "OC\Preview\Imaginary", "OC\Preview\MarkDown", "OC\Preview\MP3", "OC\Preview\TXT", "OC\Preview\OpenDocument", "OC\Preview\Movie", "OC\Preview\Krita", "OC\Preview\Imaginary" ], "enable_previews": true, "upgrade.disable-web": true, "mail_smtpmode": "smtp", "trashbin_retention_obligation": "auto, 30", "versions_retention_obligation": "auto, 30", "activity_expire_days": "30", "simpleSignUpLink.shown": false, "share_folder": "\/Shared", "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/", "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726", "allow_local_remote_servers": true, "davstorage.request_timeout": 3600, "htaccess.RewriteBase": "\/", "dbpersistent": false, "files_external_allow_create_new_local": false, "trusted_proxies": "REMOVED SENSITIVE VALUE", "preview_imaginary_url": "REMOVED SENSITIVE VALUE", "mail_from_address": "REMOVED SENSITIVE VALUE", "mail_sendmailmode": "smtp", "mail_domain": "REMOVED SENSITIVE VALUE", "mail_smtphost": "REMOVED SENSITIVE VALUE", "mail_smtpport": "465", "mail_smtpsecure": "ssl", "mail_smtpauth": 1, "mail_smtpname": "REMOVED SENSITIVE VALUE", "mail_smtppassword": "REMOVED SENSITIVE VALUE", "default_phone_region": "FR", "defaultapp": "", "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/exiftool-aarch64-musl", "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/go-vod-aarch64", "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg", "memories.vod.ffprobe": "\/usr\/bin\/ffprobe", "memories.gis_type": 2, "maintenance_window_start": 100, "preview_imaginary_key": "REMOVED SENSITIVE VALUE", "memories.db.triggers.fcu": true, "auth.bruteforce.protection.enabled": true, "ratelimit.protection.enabled": true, "debug": false },

List of activated Apps

Enabled:

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

No response

Additional info

No response

joshtrichards commented 2 months ago

I can't reproduce this. Can you share a bit more of the items from the report template, such as your config + exact Server version?

Also, any errors in your browser console when you trigger this?

There was a bug in the file picker a bit back that looked like this, but it was already fixed.

StefInP commented 2 months ago

@joshtrichards thanks for your answer. I have completed the report. I've understood what's going on : when you open the file picker, if the folder exist, it works fine. The behaviour described only occurs if the default folder does not exist in the folder tree. Simply select the folder root to see the list of folders displayed in the file picker. It's not a serious bug, but it's confusing. This is perhaps indicative of another potential bug: the overwriting of personalised settings (default folder for accepted shared) when Nextcloud is updated. I'll check the behaviour in a future update.

Zoarial94 commented 1 month ago

I think I might be running into this issue. I can consistently reproduce by having a folder with a number as a name in the viewed directory of the FilePicker. I.e. Navigate to a folder that contains the folder "2024". If the file picker attempts to show a folder with a number as the name, a function expects a string but received a number instead. An exception is thrown when accessing the lastIndexOf function of the expected string type. This is a bug in the built-in Files app or one if it's dependencies.

Unfortunately, I don't know exactly how to resolve this issue, but it appears that a modified version of a line from a utility library is the root of my issue.

This is a regression because I haven't had issues moving to or from my camera folder before. That folder is sorted by year and then month, so it's full of numbers.

Console Error:

TypeError: (intermediate value).lastIndexOf is not a function
    ne index.mjs:971
    ne index.mjs:949
    ne index.mjs:947
    ne index.mjs:998
    h FilePicker-DUbP4INd.mjs:442
    VueJS 4
    ie FilePicker-DUbP4INd.mjs:513
    VueJS 13
    c FilePicker-DUbP4INd.mjs:900
    setup FilePicker-DUbP4INd.mjs:1000
    VueJS 25
    render index.mjs:15
    VueJS 8
    u index.mjs:12
    pick index.mjs:71
    pick index.mjs:70
    async*94979/$/< moveOrCopyAction.ts:231
    $ moveOrCopyAction.ts:187
    execBatch moveOrCopyAction.ts:287
    onActionClick FilesListTableHeaderActions.vue:112
    click FilesListTableHeaderActions.vue:1
    click NcActions-CL3YRRgz.mjs:667
    VueJS 4
    click NcButton.mjs:225
vue.runtime.esm.js:3065:16

Source of the error in the browser (Line 971): image

Bugged Line from the Browser: const basename2 = (name) => name.lastIndexOf(".") > 0 ? name.slice(0, name.lastIndexOf(".")) : name; Correct Line from a nodejs library const basename = (name: string) => name.lastIndexOf('.') > 0 ? name.slice(0, name.lastIndexOf('.')) : name

major-mayer commented 4 weeks ago

I can confirm this behavior/ bug that @Zoarial94 experiences. To reproduce:

I think quite a few people will stumble over this, because it effectively prevents moving/ copying anything into a auto-upload folder, where the uploaded files are grouped into year/ month folders.

Edit: This could be the root issue for the bug that @StefInP experiences, but only if his root folder only consists of folders that have numbers as names. Otherwise, it is probably a separate issue.

StefInP commented 4 weeks ago

Hi, I think it's really two differents issues. In my case, no number in The folder name. File picker search a folder that no longer exists... and can't find it. Probably it could be handled like this : When file picker is loaded :

major-mayer commented 4 weeks ago

Okay, I will create a separate issue then.