ipfs view searches through all links now

This commit is contained in:
Tomáš Mládek 2020-07-30 00:12:02 +02:00
parent 13a6d66f32
commit da8f7b1633

View file

@ -179,6 +179,7 @@ def ExternalLinkView(request: HttpRequest):
def IPFSView(request: HttpRequest):
ipfs_matches = [re.search(r'Qm[\w]{44}', doc.url) for doc in Document.objects.all() if 'ipfs' in doc.url]
ipfs_matches = [re.search(r'Qm[\w]{44}', link.url)
for link in DocumentLink.objects.order_by('order', '-document_id') if 'ipfs' in link.url]
ipfs_cids = [match.group(0) for match in ipfs_matches if match]
return HttpResponse("\n".join(ipfs_cids), content_type='text/plain')