Open rsommerard opened 1 year ago
FYI: for encrypted and compressed file, the same issue appears. A workaround is to add input_file.seek(0)
after the input_file assignation in the decrypt block like so in dbrestore.py
file: https://github.com/jazzband/django-dbbackup/compare/master...rsommerard:django-dbbackup:fix/0b-tempfile
This workaround only works for encrypted files process.
Here a solution when the file is not encrypted or compressed, don't know if it is a good one: https://github.com/rsommerard/django-dbbackup/commit/2d84111514d30ffb0c554ec7abe78e8fa4d68d1a
Confirming we are seeing the issue when both --uncompress
and --decrypt
are passed to dbrestore
; since there is no input_file.seek(0)
in between decrypting and decompressing the file, uncompress()
doesn't read anything and hence returns an empty file.
Another workaround that doesn't require a code change is to disable compression when encryption is enabled. In our case that resulted in no measurable difference in the backup file size.
Bug Report
Running the dbrestore command raise an error which is due to
Restore tempfile created: 0 B
.Describe the bug
I use an FTP server as backup storage. Backup is store without issue on the FTP while the restore fail. If I download the file and run the command by filling the local path via the
-I
params it works well.File is not encrypted, not compressed.
The command fail at: https://github.com/jazzband/django-dbbackup/blob/af443c5026a480fffd33c4bbb6b4b1981e6700cb/dbbackup/db/base.py#L157-L163
And here is the traceback:
To Reproduce
docker run -e FTP_USER_NAME=foo -e FTP_USER_PASS=pass -e FTP_USER_HOME=/home/foo -p 21:21 -p 30000-30009:30000-30009 -d stilliard/pure-ftpd
python manage.py dbbackup
python manage.py dbrestore
Versions
django-dbbackup==4.0.2
django-storages==1.13.1
Django==3.2.7
Python: 3.8
OS: Ubuntu 22.04.1 LTS x86_64
Misc
The
mediarestore
command works with the same params (no compression, not encrypted)