Move /file/ urls to /photo/id/download.
This commit is contained in:
parent
25b0f4106f
commit
e3a0b3898f
3 changed files with 7 additions and 7 deletions
|
@ -35,8 +35,8 @@ def get_photo_json(photo_id):
|
|||
photo = flasktools.json_response(photo)
|
||||
return photo
|
||||
|
||||
@site.route('/file/<photo_id>')
|
||||
@site.route('/file/<photo_id>/<basename>')
|
||||
@site.route('/photo/<photo_id>/download')
|
||||
@site.route('/photo/<photo_id>/download/<basename>')
|
||||
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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue