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

Fix total upload size overwritten by next upload #24833

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

danxuliu
Copy link
Member

This fixes a regression introduced in 7c4c5fe

The upload progress is based on the totalToUpload variable. However, as the variable is set when an upload is submitted, if another upload is submitted before the previous one finished the upload progress only took into account the size of the new upload (although the upload itself worked fine; the files of the new submitted upload are added to the active one). Now totalToUpload is either increased or set depending on whether an upload is active or not.

Note that although data.total holds the total size of the files being uploaded totalToUpload needs to be used in fileuploadprogressall instead; totalToUpload is calculated when the upload is submitted, but since 7c4c5fe the actual upload of the files, and thus updating the value of data.total, may be deferred until the parent folders were created.

How to test

  • Open the Files app
  • Open the network tab in the developer console of the browser and throttle the connection to 3G or something similar (so you have time to do the checks)
  • Upload a 5 MiB file (you can generate it with dd if=/dev/urandom of=test-file-5mib bs=1K count=5K)
  • Before the upload finishes, upload a 100 KiB file (you can generate it with dd if=/dev/urandom of=test-file-100kib bs=1K count=100)
  • Hover on the upload progress

Result with this pull request

The upload progress is based on the size of both files

Result without this pull request

The upload progress is based only on the size of the last file

The upload progress is based on the "totalToUpload" variable. However,
as the variable is set when an upload is submitted, if another upload is
submitted before the previous one finished the upload progress only took
into account the size of the new upload (although the upload itself
worked fine; the files of the new submitted upload are added to the
active one). Now "totalToUpload" is either increased or set depending on
whether an upload is active or not.

Note that although "data.total" holds the total size of the files being
uploaded "totalToUpload" needs to be used in "fileuploadprogressall"
instead; "totalToUpload" is calculated when the upload is submitted, but
since 7c4c5fe the actual upload of the files, and thus updating the
value of "data.total", may be deferred until the parent folders were
created.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu
Copy link
Member Author

/backport to stable20

@danxuliu
Copy link
Member Author

/backport to stable19

@danxuliu
Copy link
Member Author

/backport to stable18

@rullzer rullzer mentioned this pull request Dec 23, 2020
39 tasks
@faily-bot
Copy link

faily-bot bot commented Dec 23, 2020

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 693: failure

acceptance-users

  • tests/acceptance/features/users.feature:47
Show full log
  Scenario: users navigation without disabled users                                   # /drone/src/tests/acceptance/features/users.feature:47
    Given I act as Jane                                                               # ActorContext::iActAs()
    And I am logged in as the admin                                                   # LoginPageContext::iAmLoggedInAsTheAdmin()
    And I open the User settings                                                      # SettingsMenuContext::iOpenTheUserSettings()
    And I open the "Disabled users" section                                           # AppNavigationContext::iOpenTheSection()
    And I see that the list of users contains the user disabledUser                   # UsersSettingsContext::iSeeThatTheListOfUsersContainsTheUser()
    And I open the actions menu for the user disabledUser                             # UsersSettingsContext::iOpenTheActionsMenuOf()
      Row for user disabledUser in Users Settings could not be found
      Actions menu for user disabledUser in Users Settings could not be found (NoSuchElementException)
    And I see that the "Enable user" action in the disabledUser actions menu is shown # UsersSettingsContext::iSeeTheAction()
    When I click the "Enable user" action in the disabledUser actions menu            # UsersSettingsContext::iClickTheAction()
    Then I see that the section "Disabled users" is not shown                         # AppNavigationContext::iSeeThatTheSectionIsNotShown()
    When I open the User settings                                                     # SettingsMenuContext::iOpenTheUserSettings()
    Then I see that the section "Disabled users" is not shown                         # AppNavigationContext::iSeeThatTheSectionIsNotShown()

@solracsf solracsf linked an issue Dec 27, 2020 that may be closed by this pull request
@rullzer rullzer mentioned this pull request Dec 28, 2020
39 tasks
@rullzer rullzer merged commit 86e6f07 into master Dec 28, 2020
@rullzer rullzer deleted the fix-total-upload-size-overwritten-by-next-upload branch December 28, 2020 10:18
@backportbot-nextcloud
Copy link

The backport to stable18 failed. Please do this backport manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in Tooltip of Uploading bar
3 participants