SmileyChris / easy-thumbnails

Easy thumbnails for Django
http://easy-thumbnails.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1.39k stars 319 forks source link

SuspiciousFileOperation #523

Closed juancresc closed 5 years ago

juancresc commented 5 years ago

I'm getting the following error:

...
p = Photo.objects.get(pk=1) 
thumbnailer = get_thumbnailer(p.image) 
thumbnailer['avatar']
SuspiciousFileOperation: The joined path (/media/images/photos/2013/3/image_1) is located outside of the base path component (/home/juan/Desktop/juan/dev/yas/yas_django/media)
# settings.py

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

And so the thumbs in my templates return empty string

I've seen this error in another issue but the author did not describe what he did to solve it

jrief commented 5 years ago

WHERE is your MEDIA_ROOT pointing to?

juancresc commented 5 years ago

settings.MEDIA_ROOT '/home/juan/Desktop/juan/dev/yas/media'

juancresc commented 5 years ago

images where imported prepending a /, removing that solves the issue. Errors should be stated in the template processing, it is very hard to debug

SmileyChris commented 5 years ago

Glad you sorted it out. There's no straight-forward way to raise this to the template processing layer in a nicer way -- this is core django functionality, not an addition to easy-thumbnails.