diff --git a/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py b/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py index a3f67ca..dd7187f 100644 --- a/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py @@ -35,8 +35,8 @@ def get_photo_json(photo_id): photo = flasktools.json_response(photo) return photo -@site.route('/file/') -@site.route('/file//') +@site.route('/photo//download') +@site.route('/photo//download/') def get_file(photo_id, basename=None): photo_id = photo_id.split('.')[0] photo = common.P.get_photo(photo_id) @@ -51,7 +51,7 @@ def get_file(photo_id, basename=None): if use_original_filename: download_as = photo.basename else: - download_as = photo.id + photo.dot_extension + download_as = f'{photo.id}{photo.dot_extension}' download_as = etiquette.helpers.remove_path_badchars(download_as) download_as = urllib.parse.quote(download_as) diff --git a/frontends/etiquette_flask/backend/jinja_filters.py b/frontends/etiquette_flask/backend/jinja_filters.py index eeb435f..eface50 100644 --- a/frontends/etiquette_flask/backend/jinja_filters.py +++ b/frontends/etiquette_flask/backend/jinja_filters.py @@ -42,9 +42,9 @@ def comma_join(l): @filter_function def file_link(photo, short=False): if short: - return f'/file/{photo.id}{photo.dot_extension}' + return f'/photo/{photo.id}/download/{photo.id}{photo.dot_extension}' basename = jinja2.filters.do_urlencode(photo.basename) - return f'/file/{photo.id}/{basename}' + return f'/photo/{photo.id}/download/{basename}' @filter_function def islice(gen, start, stop): diff --git a/frontends/etiquette_flask/static/js/cards.js b/frontends/etiquette_flask/static/js/cards.js index 8188078..b67f1a4 100644 --- a/frontends/etiquette_flask/static/js/cards.js +++ b/frontends/etiquette_flask/static/js/cards.js @@ -143,10 +143,10 @@ function file_link(photo, short) { if (short) { - return `/file/${photo.id}${photo.dot_extension}`; + return `/photo/${photo.id}/download/${photo.id}${photo.dot_extension}`; } const basename = escape(photo.filename); - return `/file/${photo.id}/${basename}`; + return `/photo/${photo.id}/download/${basename}`; } cards.photos.create =