bradleyg / django-s3direct

Directly upload files to S3 compatible services with Django.
MIT License
661 stars 234 forks source link

Multiple destinations ignored when uploading the same file #145

Closed margusholland closed 5 years ago

margusholland commented 6 years ago

I’m having a strange issue when I have configured multiple destinations.

path_date = datetime.now().strftime("%Y/%m/%d")
S3DIRECT_DESTINATIONS = {
    'one_upload': {
        'key': 'path_one/%s' % path_date,
        'auth': lambda u: u.is_staff,
        'cache_control': 'max-age=86400',
        'acl': 'private',
    },
    'another_upload': {
        'key': 'path_two/covers/%s' % path_date,
        'auth': lambda u: u.is_staff,
        'cache_control': 'max-age=86400',
    },
    'third_upload': {
        'key': 'upload/%s' % path_date,
        'auth': lambda u: u.is_staff,
        'cache_control': 'max-age=86400',
    },
}

If I try to upload the same file using the different destinations, they end up in the first destination I used. For example if I upload "foobar.jpg" to destination one_upload and try to upload it again to third_upload, I’m actually seeing the file in both cases referencing the from the first destination.

Have a configured something incorrectly?

bradleyg commented 5 years ago

Hey @margusholland, did you fix this in the end? Please reopen if you're still seeing this bug.