mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-05 15:05:48 +02:00
Make buildPutDiffers() work with empty files.
If the file was empty the timestamp was updated. If the file is empty and there is no content then file should not be saved.
This commit is contained in:
parent
800d2972b0
commit
d7d663c2b9
@ -32,22 +32,27 @@ sub buildPutDiffers
|
||||
{
|
||||
my $oStorage = shift;
|
||||
my $strFile = shift;
|
||||
my $strContents = shift;
|
||||
my $strContentNew = shift;
|
||||
|
||||
# Attempt to load the file
|
||||
my $bSave = true;
|
||||
my $oFile = $oStorage->openRead($strFile, {bIgnoreMissing => true});
|
||||
|
||||
# If file was found see if the content is the same
|
||||
if (defined($oFile) && ${$oStorage->get($oFile)} eq $strContents)
|
||||
if (defined($oFile))
|
||||
{
|
||||
$bSave = false;
|
||||
my $strContentFile = ${$oStorage->get($oFile)};
|
||||
|
||||
if ((defined($strContentFile) ? $strContentFile : '') eq (defined($strContentNew) ? $strContentNew : ''))
|
||||
{
|
||||
$bSave = false;
|
||||
}
|
||||
}
|
||||
|
||||
# Save if the contents are different or missing
|
||||
if ($bSave)
|
||||
{
|
||||
$oStorage->put($oStorage->openWrite($strFile, {bPathCreate => true}), $strContents);
|
||||
$oStorage->put($oStorage->openWrite($strFile, {bPathCreate => true}), $strContentNew);
|
||||
}
|
||||
|
||||
# Was the file saved?
|
||||
|
Loading…
x
Reference in New Issue
Block a user