Skip to content

Commit

Permalink
Merge pull request #925 from kobotoolbox/fix-corrupted-large-s3-files
Browse files Browse the repository at this point in the history
Fix corrupted large ZIP files with AWS S3 storage
  • Loading branch information
jnm authored Jul 8, 2024
2 parents 2dd751f + eb37e64 commit 79ac8e0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions onadata/apps/storage_backends/s3boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import logging

import storages.backends.s3boto3 as upstream
import storages.backends.s3 as upstream
from django.utils.deconstruct import deconstructible


class S3Boto3StorageFile(upstream.S3Boto3StorageFile):
@deconstructible
class S3File(upstream.S3File):
def __init__(self, name, mode, storage, buffer_size=None):
super().__init__(name, mode, storage, buffer_size)
self._remote_file_size = 0
Expand All @@ -31,9 +33,10 @@ def _flush_write_buffer(self):
self.file.truncate()


upstream.S3Boto3StorageFile = S3Boto3StorageFile
upstream.S3File = S3File


class S3Boto3Storage(upstream.S3Boto3Storage):
# Uses the overridden S3Boto3StorageFile
@deconstructible
class S3Boto3Storage(upstream.S3Storage):
# Uses the overridden S3File
pass

0 comments on commit 79ac8e0

Please sign in to comment.