diff --git a/dbfilestorage/storage.py b/dbfilestorage/storage.py index 94ff433..e8f2bab 100644 --- a/dbfilestorage/storage.py +++ b/dbfilestorage/storage.py @@ -47,6 +47,10 @@ class DBFileStorage(Storage): """ if hasattr(content.file, "read"): read_data = content.file.read() + if not read_data: + # If it's empty, try to seek once. + content.file.seek(0) + read_data = content.file.read() else: read_data = content.file.encode('utf8') b64 = read_data.encode('base64') diff --git a/docs/conf.py b/docs/conf.py index 947bd1a..4023b5b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,7 +54,7 @@ author = u'Tyrel Souza' # built documents. # # The short X.Y version. -version = u'0.9.1' +version = u'0.9.2' # The full version, including alpha/beta/rc tags. release = version diff --git a/setup.py b/setup.py index decd5cc..8e6f986 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ class CleanCommand(Command): setup( name="django-dbfilestorage", - version="0.9.1", + version="0.9.2", description="Database backed file storage for testing.", long_description="Database backed file storage for testing. Stores files as base64 encoded textfields.", author="Tyrel Souza",