nextcloud / server

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

[Bug]: file upload in group folder failed when a user has no quota #39533

Closed mueller-tobias closed 1 year ago

mueller-tobias commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

An user have a quota of 0B as he don't need to upload on his personal folder but only in a group folder (with quota of 500MB)

If both quotas are full, any upload would return an error. Thats fine.

But any other upload as long as the group folder has quota left should complete. I can upload files smaller 10 MB sucessfully. After that nextcloud will try a multi part upload. I've already increase the s3 parameter for putSizeLimit, uploadPartSize and the Files max_chunk_size configuration. But the max file upload when a user has no quota was still 10 MB. With a higher Quota i can automtically upload files according to the limit of the user.

After the upload the file counts correctly against the group folder and not the user quota.

I think it is related to #37436. The user describes the same problem but with an other focus.

With the old "assemble" upload system on nextcloud 25 we had this bug not.

Steps to reproduce

  1. Configure Primary Storage to S3
  2. Set User quota to 0B
  3. Set a group folder with quota to 500M, fullfill it
  4. Try to upload any files via WebBrowser

Expected behavior

The upload should complete if there's enough free quota inside the group folder. It shouldn't necessary to give the user a personal quota to upload files to a group folder.

Installation method

Community Docker image

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

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

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

What user-backends are you using?

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "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
            }
        ],
        "objectstore": {
            "class": "\\OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "bucket": "nextcloud",
                "autocreate": true,
                "key": "***REMOVED SENSITIVE VALUE***",
                "secret": "***REMOVED SENSITIVE VALUE***",
                "region": "us-east-1",
                "use_ssl": true,
                "hostname": "*****",
                "use_path_style": true,
                "putSizeLimit": 524288000
            }
        },
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "*****"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "26.0.2.1",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "skeletondirectory": "",
        "templatedirectory": "",
        "hide_login_form": true,
        "trashbin_retention_obligation": "90, 90",
        "versions_retention_obligation": "disabled",
        "defaultapp": "files",
        "social_login_auto_redirect": false,
        "webhooks_user_created_url": "*****",
        "allow_user_to_change_display_name": false,
        "lost_password_link": "disabled",
        "oidc_login_provider_url": "****",
        "oidc_login_client_id": "nextcloud",
        "oidc_login_client_secret": "*****",
        "oidc_login_auto_redirect": false,
        "oidc_login_logout_url": "*****",
        "oidc_login_end_session_redirect": true,
        "oidc_login_button_text": "Anmelden mit Servicekonto",
        "oidc_login_hide_password_form": true,
        "oidc_login_use_id_token": false,
        "oidc_login_attributes": {
            "id": "sub",
            "name": "preferred_username",
            "mail": "email"
        },
        "oidc_login_default_group": "oidc",
        "oidc_login_use_external_storage": false,
        "oidc_login_scope": "openid profile",
        "oidc_login_proxy_ldap": false,
        "oidc_login_disable_registration": false,
        "oidc_login_redir_fallback": false,
        "oidc_login_alt_login_page": "assets\/login.php",
        "oidc_login_tls_verify": true,
        "oidc_create_groups": false,
        "oidc_login_webdav_enabled": false,
        "oidc_login_password_authentication": false,
        "oidc_login_public_key_caching_time": 86400,
        "oidc_login_min_time_between_jwks_requests": 10,
        "oidc_login_well_known_caching_time": 86400,
        "oidc_login_update_avatar": false,
        "oidc_login_skip_proxy": false,
        "oidc_login_code_challenge_method": "S256",
        "loglevel": 2,
        "webhooks_secret": "i~WbMkixc9p4rkDWPmJhYJD9Pq^rqJc&xyS",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "overwriteprotocol": "https",
        "overwritecondaddr": "",
        "mail_smtpauth": 1,
        "force_language": "de_DE",
        "mail_smtpsecure": "tls",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "app_install_overwrite": [
            "oidc_login",
            "webhooks"
        ],
        "enable_encryption": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "6379",
            "password": "***REMOVED SENSITIVE VALUE***"
        }
    }
}

List of activated Apps

Enabled:
  - activity: 2.18.0
  - announcementcenter: 6.6.1
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - comments: 1.16.0
  - contacts: 5.3.2
  - contactsinteraction: 1.7.0
  - dav: 1.25.0
  - encryption: 2.14.0
  - external: 5.1.0
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_accesscontrol: 1.16.0
  - files_antivirus: 5.2.1
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - groupfolders: 14.0.3
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - nextcloud_announcements: 1.15.0
  - notifications: 2.14.0
  - oauth2: 1.14.0
  - oidc_login: 2.6.0
  - password_policy: 1.16.0
  - photos: 2.2.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - terms_of_service: 2.2.0
  - text: 3.7.2
  - theming: 2.1.1
  - theming_customcss: 1.14.0
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - weather_status: 1.6.0
  - webhooks: 0.4.3
  - workflowengine: 2.8.0
Disabled:
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - dashboard: 7.6.0 (installed 7.6.0)
  - files_external: 1.18.0
  - firstrunwizard: 2.15.0 (installed 2.14.0)
  - login_notes: 1.2.0 (installed 1.2.0)
  - suspicious_login: 4.4.0
  - twofactor_totp: 8.0.0
  - user_ldap: 1.16.0
  - welcome: 1.0.9 (installed 1.0.9)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{
  "reqId": "EKwoi1R8q7cjmMByFJDX",
  "level": 3,
  "time": "2023-07-21T20:29:34+00:00",
  "remoteAddr": "95.208.163.162",
  "user": "68cc1703-5571-4507-ab2b-23e9eb7341ca",
  "app": "webdav",
  "method": "PUT",
  "url": "/remote.php/dav/uploads/68cc1703-5571-4507-ab2b-23e9eb7341ca/web-file-upload-b0da276b94f227fa7a067f327ae7ed7a-1689971373421/1",
  "message": "Insufficient space in files/68cc1703-5571-4507-ab2b-23e9eb7341ca/Nx26Test/anydesk.dmg",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
  "version": "26.0.2.1",
  "exception": {
    "Exception": "Sabre\\DAV\\Exception\\InsufficientStorage",
    "Message": "Insufficient space in files/68cc1703-5571-4507-ab2b-23e9eb7341ca/Nx26Test/anydesk.dmg",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "beforePut",
        "class": "OCA\\DAV\\Upload\\ChunkingV2Plugin",
        "type": "->",
        "args": [
          [
            "Sabre\\HTTP\\Request"
          ],
          [
            "Sabre\\HTTP\\Response"
          ]
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 456,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "beforeMethod:PUT",
          [
            [
              "Sabre\\HTTP\\Request"
            ],
            [
              "Sabre\\HTTP\\Response"
            ]
          ]
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 253,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          [
            "Sabre\\HTTP\\Request"
          ],
          [
            "Sabre\\HTTP\\Response"
          ]
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 321,
        "function": "start",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/apps/dav/lib/Server.php",
        "line": 366,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
        "line": 35,
        "function": "exec",
        "class": "OCA\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/html/remote.php",
        "line": 172,
        "args": [
          "/var/www/html/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/apps/dav/lib/Upload/ChunkingV2Plugin.php",
    "Line": 174,
    "message": "Insufficient space in files/68cc1703-5571-4507-ab2b-23e9eb7341ca/Nx26Test/anydesk.dmg",
    "exception": {},
    "CustomMessage": "Insufficient space in files/68cc1703-5571-4507-ab2b-23e9eb7341ca/Nx26Test/anydesk.dmg"
  }
}

Additional info

No response

aimee-889 commented 1 year ago

this seems to be fixed in version 26.0.5 - at least it worked for us. See https://github.com/nextcloud/server/commit/2124fb9ff25529b069dee4ca946969252ab5ef8a

mueller-tobias commented 1 year ago

Thanks! I can confirm that the bug is fixed with 26.0.5.