Quick fix for issue 51. Moved upload, download logging logic into
shared method, added unit test.

Note: although it no longer fails when downloading an empty file, it
will log the empty warning twice...
Merge pull request #53 from chqr/master

Fix an issue when downloading empty (or non-existent) files.