Skip to content

Commit

Permalink
Merge pull request the-paperless-project#481 from CkuT/cache-control
Browse files Browse the repository at this point in the history
Add Cache-Control header for thumbnails
  • Loading branch information
danielquinn authored Jan 27, 2019
2 parents 611ec68 + 7986893 commit c5c204f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.views.generic import DetailView, FormView, TemplateView
from django_filters.rest_framework import DjangoFilterBackend
from django.conf import settings
from django.utils import cache

from paperless.db import GnuPG
from paperless.mixins import SessionOrBasicAuthMixin
Expand Down Expand Up @@ -56,10 +57,12 @@ def render_to_response(self, context, **response_kwargs):
}

if self.kwargs["kind"] == "thumb":
return HttpResponse(
response = HttpResponse(
self._get_raw_data(self.object.thumbnail_file),
content_type=content_types[Document.TYPE_PNG]
)
cache.patch_cache_control(response, max_age=31536000, private=True)
return response

response = HttpResponse(
self._get_raw_data(self.object.source_file),
Expand Down

0 comments on commit c5c204f

Please sign in to comment.