thumb auth fix
This commit is contained in:
parent
aff62835ec
commit
c232be79ee
|
@ -283,8 +283,10 @@ class ThumbnailView(object):
|
||||||
uuid = uuid.split(".")[0]
|
uuid = uuid.split(".")[0]
|
||||||
s = self.master.session()
|
s = self.master.session()
|
||||||
|
|
||||||
query = photo_auth_filter(s.query(Photo)).filter(Photo.set.has(uuid=uuid)) if item_type == "set" \
|
query = photo_auth_filter(s.query(Photo).join(PhotoSet))
|
||||||
else photo_auth_filter(s.query(Photo)).filter(Photo.uuid == uuid) if item_type == "one" \
|
|
||||||
|
query = query.filter(Photo.set.has(uuid=uuid)) if item_type == "set" \
|
||||||
|
else query.filter(Photo.uuid == uuid) if item_type == "one" \
|
||||||
else None
|
else None
|
||||||
|
|
||||||
assert query
|
assert query
|
||||||
|
@ -299,8 +301,9 @@ class ThumbnailView(object):
|
||||||
best = photo
|
best = photo
|
||||||
break
|
break
|
||||||
thumb_from = best or first
|
thumb_from = best or first
|
||||||
|
print(repr(thumb_from))
|
||||||
if not thumb_from:
|
if not thumb_from:
|
||||||
raise Exception("404")
|
raise cherrypy.HTTPError(404)
|
||||||
# TODO some lock around calls to this based on uuid
|
# TODO some lock around calls to this based on uuid
|
||||||
thumb_path = self.master.library.make_thumb(thumb_from, thumb_size)
|
thumb_path = self.master.library.make_thumb(thumb_from, thumb_size)
|
||||||
if thumb_path:
|
if thumb_path:
|
||||||
|
@ -328,6 +331,8 @@ class DownloadView(object):
|
||||||
else None # TODO set download query
|
else None # TODO set download query
|
||||||
|
|
||||||
item = query.first()
|
item = query.first()
|
||||||
|
if not item:
|
||||||
|
raise cherrypy.HTTPError(404)
|
||||||
extra = {}
|
extra = {}
|
||||||
if not preview:
|
if not preview:
|
||||||
extra.update(disposition="attachement", name=os.path.basename(item.path))
|
extra.update(disposition="attachement", name=os.path.basename(item.path))
|
||||||
|
|
Loading…
Reference in New Issue