Fixed issue where a newline is sometimes added to the end of a download output due to how short the download process was, mitigated the issue by enforcing a "done" update at the end of the download process
A fix has been implemented for an issue where a newline was unintentionally added to the end of download output, mostly when the download process was too short. This has been mitigated by ensuring a "done" update whenever a download finishes. At the same time, improvements have been made to the download progress output. Specifically, the downloaded size now won't exceed the total download size, and a definitive "100%" progress indication is enforced when the download ends.
This commit is contained in:
parent
aa6800e96a
commit
de1e199dff
3 changed files with 16 additions and 2 deletions
|
@ -20,6 +20,8 @@ This update introduces minor bug fixes.
|
||||||
- Fixed division by zero in ConsoleProgressBar
|
- Fixed division by zero in ConsoleProgressBar
|
||||||
- Fixed issue where progress bar is displayed in VERBOSE mode
|
- Fixed issue where progress bar is displayed in VERBOSE mode
|
||||||
- Set default process timeouts to null
|
- Set default process timeouts to null
|
||||||
|
- Fixed issue where a newline is sometimes added to the end of a download output due to how short the download process
|
||||||
|
was, mitigated the issue by enforcing a "done" update at the end of the download process
|
||||||
|
|
||||||
|
|
||||||
## [2.0.3] - 2023-10-17
|
## [2.0.3] - 2023-10-17
|
||||||
|
|
|
@ -906,6 +906,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($downloaded > $download_size)
|
||||||
|
{
|
||||||
|
$download_size = $downloaded;
|
||||||
|
}
|
||||||
|
|
||||||
if(Resolver::checkLogLevel(LogLevel::VERBOSE, Main::getLogLevel()))
|
if(Resolver::checkLogLevel(LogLevel::VERBOSE, Main::getLogLevel()))
|
||||||
{
|
{
|
||||||
$percentage = round(($downloaded / $download_size) * 100, 2);
|
$percentage = round(($downloaded / $download_size) * 100, 2);
|
||||||
|
@ -926,10 +931,14 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unset($progress_bar);
|
|
||||||
curl_exec($curl);
|
curl_exec($curl);
|
||||||
fclose($file_handle);
|
fclose($file_handle);
|
||||||
|
|
||||||
|
$progress_bar->setMaxValue(100);
|
||||||
|
$progress_bar->setValue(100);
|
||||||
|
$progress_bar->setMiscText('done', true);
|
||||||
|
unset($progress_bar);
|
||||||
|
|
||||||
if(curl_errno($curl))
|
if(curl_errno($curl))
|
||||||
{
|
{
|
||||||
ShutdownHandler::declareTemporaryPath($file_path);
|
ShutdownHandler::declareTemporaryPath($file_path);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
namespace ncc\Objects\PackageLock;
|
namespace ncc\Objects\PackageLock;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use ncc\Classes\PackageReader;
|
use ncc\Classes\PackageReader;
|
||||||
use ncc\Enums\FileDescriptor;
|
use ncc\Enums\FileDescriptor;
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
use ncc\Objects\ProjectConfiguration\UpdateSource;
|
use ncc\Objects\ProjectConfiguration\UpdateSource;
|
||||||
use ncc\ThirdParty\composer\Semver\Semver;
|
use ncc\ThirdParty\composer\Semver\Semver;
|
||||||
use ncc\ThirdParty\jelix\Version\VersionComparator;
|
use ncc\ThirdParty\jelix\Version\VersionComparator;
|
||||||
|
use ncc\Utilities\Console;
|
||||||
use ncc\Utilities\Functions;
|
use ncc\Utilities\Functions;
|
||||||
use ncc\Utilities\IO;
|
use ncc\Utilities\IO;
|
||||||
|
|
||||||
|
@ -189,8 +191,9 @@
|
||||||
{
|
{
|
||||||
$version = $this->getLatestVersion();
|
$version = $this->getLatestVersion();
|
||||||
}
|
}
|
||||||
catch(InvalidArgumentException $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
Console::outWarning(sprintf('Unable to find latest version for package %s, called on versionExists() in PackageEntry: %s', $this->name, $e->getMessage()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue