theriverman / django-minio-backend

Minio Backend for Django
https://pypi.org/project/django-minio-backend/
MIT License
111 stars 22 forks source link

For public files, click on their link does not start download immediately #22

Closed ghorbani-mohammad closed 3 years ago

ghorbani-mohammad commented 3 years ago

Hello,

In Django admin, for private files clicking on the file link immediately starts to download the file. But for public files clicking on the link transfer user to the Minio dashboard. The user has to click on the download button to download the file.

I want links for public files to be the same as private files. (immediately start download after clicking on them) How can I achieve this?

Thanks.

theriverman commented 3 years ago

Hi @ghorbani-mohammad

It's hard to tell what's causing this odd behaviour in your setup. I have just tested this in a newly created developer environment ( see file CONTRIBUTE.md for instructions) and it works fine for both public and private buckets.

Please use the example application ( DjangoExampleApplication/models.py ) as reference to correctly implement your models and their respective admin ( DjangoExampleApplication/admin.py ) fields.

If it's still not working, please tell a bit more about your environment:

Please make sure you've pulled the latest repo, because I've just pushed a correction commit to master to fix a refactoring error in DjangoExampleApplication.

ghorbani-mohammad commented 3 years ago

Thank you, @theriverman, for the reply. My model is in the below picture. So you think this model is not correctly implemented?

I saw your model example. You put some functions and property in the model. Do I need to put those in my model?

image

theriverman commented 3 years ago

Your model looks good.

I have a feeling the problem is not in Django but maybe in MinIO or your proxy (if you're using any). Could you clone the latest version of this repo and follow all steps in CONTRIBUTE.md, please? Don't forget adding your own MinIO connection details in DjangoExampleProject/settings.py.

Then just go to the admin page, add a private and a public file, and see if the generated URL works. If they're OK, the problem is probably in your Django application. If they're broken, the problem is either in MinIO or somewhere along the way between Django and MinIO.

Let me know of your results!

theriverman commented 3 years ago

I'm closing this issue now due to inactivity. Please feel free to reopen if you're problem still persists.