Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Subtract size of export file from estimate
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal authored and backportbot-nextcloud[bot] committed Jun 10, 2022
commit 0705281f6b2ac1d995ca88a55ac00be131b508b4
11 changes: 11 additions & 0 deletions lib/Migrator/FilesMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ public function getEstimatedExportSize(IUser $user): int {

$size = $userFolder->getSize() / 1024;

try {
$exportFile = $userFolder->get(ExportDestination::EXPORT_FILENAME);
if (!($exportFile instanceof File)) {
throw new \InvalidArgumentException('User export is not a file');
}

$size -= $exportFile->getSize() / 1024;
} catch (NotFoundException $e) {
// No size subtraction needed if export file doesn't exist
}

try {
$versionsFolder = $this->root->get('/'.$uid.'/'.FilesVersionsStorage::VERSIONS_ROOT);
if ($versionsFolder instanceof Folder) {
Expand Down