alican / django-tus

Django app implementing server side of tus protocol to powering resumable file uploads for django projects. More Info about: http://tus.io/
MIT License
49 stars 32 forks source link

Fix for issue #18 #19

Closed arturzx closed 3 years ago

arturzx commented 4 years ago

I've made fix for issue #18. Chunk file upload leads to file with zeroes and last chunk. Problem is 'wb' mode when opening file. This mode always truncating file and seek() to chunk offset leads to fill file with zeroes.

My patch changes file creation - open with 'wb' mode and write one \0 byte at file_size-1 offset, this operation creates sparse file with proper size, and chunk writes to file opened with 'r+b' mode - read and write, without truncating.

jsproull commented 4 years ago

👍 Thanks so much @arturzx !!

jsproull commented 4 years ago

@alican any chance we can get a version with this PR?

alican commented 4 years ago

@alican any chance we can get a version with this PR?

Hey @jsproull , Thanky you for your pull request. I will check it tonight and merge it to the master branch.