andreafabrizi / Dropbox-Uploader

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.
https://www.andreafabrizi.it/2016/01/01/Dropbox-Uploader/
GNU General Public License v3.0
6.56k stars 1.08k forks source link

Empty files are not overwritten with non-empty ones #553

Open ale-rinaldi opened 2 years ago

ale-rinaldi commented 2 years ago

Hello,

first of all, thanks for this script, it's really useful in my workflow.

I noticed an issue where empty (zero-byte) files are never overwritten with non-empty files.

Steps to reproduce

# Create an empty file
$ touch empty-file.txt
# Create a non-empty file
$ echo "Some text" > non-empty-file.txt
# Upload the empty file
$ ./dropbox_uploader.sh upload empty-file.txt /Temp/test.txt
 > Uploading "/home/dropbox/empty-file.txt" to "/Temp/test.txt"... DONE
# Upload the non-empty file trying to overwrite the empty one
$ ./dropbox_uploader.sh upload non-empty-file.txt /Temp/test.txt
 > Skipping file "/home/dropbox/non-empty-file.txt", file exists with the same hash

What should happen

The second file, different from the first, empty one, is uploaded and overwrites the empty one

What actually happens

The upload is skipped because the files are considered identical