Thumbnails don't work with S3 storage
Deployment Type
Self-hosted
NetBox Version
v4.4.0-beta1
Python Version
3.12
Steps to Reproduce
I first opened this as discussion #20113 but after further investigation I'm convinced it's a bug in the sorl-thumbnail library.
With the default storage in S3, thumbnails are never generated or loaded.
Steps to reproduce:
- Configure the default storage to be in S3 like this:
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3.S3Storage",
"OPTIONS": {
'bucket_name': 'mybucket',
'region_name': 'us-east-1',
'location': 'storage'
}
},
}
- Load any image-attachments webpage, i.e.
/dcim/locations/12218/image-attachments/.
Expected Behavior
Thumbnails should be generated automatically, written to S3, and displayed in the browser.
Observed Behavior
It just displays the filename with no image.
I think there are 2 issues here. The first is fixed here but that hasn't made it into a release version yet, so Netbox doesn't have it.
The other is discussed here and here, and it seems to be fixed by this PR. I just pip installed that git branch in my Netbox test instance and thumbnails started working, without any changes to configuration.py.
Marking as blocked by #748 in sorl-thumbnail. sorl is just used in one place in NetBox (image attachments) so would be fairly easy to replace, however it looks like the best other maintained library that is close is easy-thumbnails as switching to it would probably just be switching on set of issues to another.
On the sorl side there is an issue with imagemagick and tests (#781), if that can be resolved then a new release can probably be pushed through. Trying to help over there to get a release made as there are already fixes that seem to address this issue.
sorl-thumbnail v13.0.0 has been released. This should be revisited to see what (if any) work is needed in NetBox at this stage.
I've been running for the last 2 weeks with sorl-thumbnail.git@92f1734 and it seems fine. I think the only change to Netbox will be requirements.txt but we are still waiting for it to be published to pypi.
Marking this as still blocked as sorl-thumbnail has not published to pypi.