Re-allow framing of images in docs
authorMagnus Hagander <magnus@hagander.net>
Wed, 15 Sep 2021 20:08:12 +0000 (22:08 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 15 Sep 2021 20:10:33 +0000 (22:10 +0200)
Commit fff74828 disallowed the loading of docs in frames, but apparently
svg images count as framing, so re-allow those.

We could limit it to specific URLs, but it's just images so it's good to
be able to load them from different places.

Discussion: https://postgr.es/m/CAH2-WzkpfQROHTx_F3RM6AUbxquxHy4QWXfVkNPWm3s9AFmtkg@mail.gmail.com

pgweb/docs/views.py

index 236c5c7314b8fb6ab597a16686b8ca74de8a41f6..9def765707e4596833d9e2d3d4109011bedf3ecb 100644 (file)
@@ -1,7 +1,7 @@
 from django.shortcuts import render, get_object_or_404
 from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseNotFound
 from django.http import HttpResponse, Http404
-from pgweb.util.decorators import login_required, content_sources
+from pgweb.util.decorators import login_required, content_sources, allow_frames
 from django.template.defaultfilters import strip_tags
 from django.db.models import Q
 from django.conf import settings
@@ -150,6 +150,7 @@ def docpage(request, version, filename):
     return r
 
 
+@allow_frames
 def docsvg(request, version, filename):
     if version == 'current':
         ver = Version.objects.filter(current=True)[0].tree