fix colleciton links

This commit is contained in:
j 2023-07-20 12:33:12 +01:00
parent b13b621fd0
commit 6e283ad870

View file

@ -518,6 +518,7 @@ actions.register(autocompleteDocuments)
def document(request, fragment): def document(request, fragment):
context = {} context = {}
parts = fragment.split('/') parts = fragment.split('/')
# FIXME: parse collection urls and return the right metadata for those
id = parts[0] id = parts[0]
page = None page = None
crop = None crop = None
@ -527,7 +528,10 @@ def document(request, fragment):
page = rect[0] page = rect[0]
else: else:
crop = rect crop = rect
try:
document = models.Document.objects.filter(id=ox.fromAZ(id)).first() document = models.Document.objects.filter(id=ox.fromAZ(id)).first()
except:
document = None
if document and document.access(request.user): if document and document.access(request.user):
context['title'] = document.data['title'] context['title'] = document.data['title']
if document.data.get('description'): if document.data.get('description'):