Skip to content

Not enough free space" when uploading: Sometimes wrong freeSpace calculation #49201

Open

Description

@andreas-p

Somewhere between 20.0.1 and 20.0.9, the calculation of freespace when uploading was changed.

I'm using an app that uploads to not-yet-existing directories, relying on NC creating them implicitely which works fine, unless freeSpace is not calculated (and thus 0) which happens in this case.

Previously, file-upload.js OC.FileUpload.add() would just use the global freeSpace from $('#free_space').val(). Now, freeSpace is initialized as 0, and calculated for some data scenarios. If those scenarios are not met, it will remain 0, failing the upload with "Not enough free space".

freeSpace should be initialized to the global freeSpace as before, and then recalculated for specific situations to make sure freeSpace is valid in all situations.

Issue is still present in NC30.

Activity

  1. joshtrichards commented on Nov 11, 2024

    @joshtrichards
    Member

    I'm having difficulty following your report and, unfortunately, you completely skipped our reporting template.

    OC is not a public API.

    If you're trying to report a bug, please provide reproduction steps/etc.

    Note that v20 reached end-of-life years ago.

  2. andreas-p commented on Nov 11, 2024

    @andreas-p
    Author

    When Clicking "New Issue", there's no reporting template, didn't skip anything...

    excerpt from file-upload.js:

    var freeSpace = 0;
    (...)
    if (!self.fileList || upload.getTargetFolder() === self.fileList.getCurrentDirectory()) {
         // Use global free space if there is no file list to check or the current directory is the target
         freeSpace = $('input[name=free_space]').val()
    } else if (upload.getTargetFolder().indexOf(self.fileList.getCurrentDirectory()) === 0) {
         // Check subdirectory free space if file is uploaded there
         // Retrieve the folder destination name
         var targetSubdir = upload._targetFolder.split('/').pop()
         freeSpace = parseInt(upload.uploader.fileList.getModelForFile(targetSubdir).get('quotaAvailableBytes'))
     }
    
    

    There's no else branch, so if the conditions aren't met, no freespace is assumed, which is wrong in most cases and prevents uploads unnecessarily.
    Initializing freeSpace with -1 is a viable fix, because this will let the final word to the server, who knows it better anyway.

  3. joshtrichards commented on Nov 11, 2024

    @joshtrichards
    Member

    When Clicking "New Issue", there's no reporting template, didn't skip anything...

    Are you on a mobile device? Sometimes GitHub doesn't use the correct Issue templates on mobile platforms.

    so if the conditions aren't met, no freespace is assumed, which is wrong in most cases and prevents uploads unnecessarily.

    Can you provide a specific example that triggers one of these scenarios in v28-v30?

    I'm using an app [...]

    What app?

    P.S. This code has been in place since NC 22 (#24102). It's also gone from our master branch (upcoming v31), but if there is an actual bug we'd likely want to fix it for the still supported v28-v30 branches.

    P.P.S. This appears to be a duplicate of your report in #27367

  4. solracsf commented on Nov 12, 2024

    @solracsf
    Member
  5. andreas-p commented on Nov 13, 2024

    @andreas-p
    Author

    @solracsf When I created the issue, there was no selection as can be seen now on "New issue"; instead, I was directed to the blank issue directly.

    @joshtrichards It's my own app which accepts files on some spot, not published. Seems that not too many people can trigger this bug.
    Since the code will be gone soon, I'd have to recode that, to use the new stuff anyway. Can you give me an upfront hint where to look at?

  6. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Apr 5, 2025
  7. added theissue type on Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions