From c6d92189b28ce27feb2a82ba3fbde53c3e497cc6 Mon Sep 17 00:00:00 2001 From: jnm Date: Mon, 20 Jul 2020 01:42:04 -0400 Subject: [PATCH] Encode image filenames when building gallery URLs Fixes #621 --- onadata/apps/main/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/onadata/apps/main/views.py b/onadata/apps/main/views.py index c2310a6dc..aac19c862 100644 --- a/onadata/apps/main/views.py +++ b/onadata/apps/main/views.py @@ -1099,11 +1099,9 @@ def form_photos(request, username, id_string): continue data = {} - - for i in ['small', 'medium', 'large', 'original']: - url = reverse(attachment_url, kwargs={'size': i}) - url = '%s?media_file=%s' % (url, attachment.media_file.name) - data[i] = url + data['original'] = attachment.secure_url() + for suffix in settings.THUMB_CONF.keys(): + data[suffix] = attachment.secure_url(suffix) image_urls.append(data)