File picker offers "New" even without create permission or quota

Open Beginner friendly
#2,771 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Start with lib/components/FilePicker/FilePicker.vue, especially the menu visibility around lines 28–29 and onCreateFolder() around line 322. Check how the picker exposes the current folder's create permission and quota, then add or update a test for folders without create permission or with zero available quota. Done means the “New” menu is hidden or disabled in those cases.

Written by the indexing model from the issue text.

Description

bug
Describe the bug

The file picker always shows the "New" (create folder) menu, independent of whether the user may create something in the current folder (no create permission, or no quota left):

https://github.com/nextcloud-libraries/nextcloud-dialogs/blob/636c9a8ea2700380d4cd8d1b0b1d57d50850ab29/lib/components/FilePicker/FilePicker.vue#L28-L29

Only noMenu hides it. onCreateFolder() then simply tries to create the folder and shows the resulting error:

https://github.com/nextcloud-libraries/nextcloud-dialogs/blob/636c9a8ea2700380d4cd8d1b0b1d57d50850ab29/lib/components/FilePicker/FilePicker.vue#L322

Originally reported in nextcloud/server#57440 (file picker of Photos, Collectives and others with an account whose quota is 0 B).

To Reproduce
  1. Set an account's quota to 0 B (or open a read-only shared folder in the picker).
  2. Open any file picker (e.g. "Move or copy", or the folder picker in Photos).
  3. The "New" menu is offered; creating a folder fails with an error.
Expected behavior

The "New" menu is hidden or disabled when the current folder lacks the create permission or quota-available-bytes is 0 (similar to how the Files app hides its "New" button), with a test.

Dominant language
TypeScript
Stars
19
Forks
10
Avg merge
17h 4m
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud-libraries/nextcloud-dialogs

All issues in nextcloud-libraries/nextcloud-dialogs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.