mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Merge branch 'ENH_config_inline_or_attach' of git://github.com/jat255/paperless into jat255-ENH_config_inline_or_attach
This commit is contained in:
		
						commit
						f94347abc0
					
				@ -117,6 +117,10 @@ PAPERLESS_EMAIL_SECRET=""
 | 
			
		||||
# http://paperless.readthedocs.org/en/latest/consumption.html#hooking-into-the-consumption-process
 | 
			
		||||
#PAPERLESS_POST_CONSUME_SCRIPT="/path/to/an/arbitrary/script.sh"
 | 
			
		||||
 | 
			
		||||
# By default, when clicking on a document within the web interface, the
 | 
			
		||||
# browser will prompt the user to save the document to disk. By uncommenting
 | 
			
		||||
# the below, the document will instead be opened in the browser, if possible.
 | 
			
		||||
#PAPERLESS_INLINE_DOC="true"
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# The following values use sensible defaults for modern systems, but if you're
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,8 @@
 | 
			
		||||
from django.http import HttpResponse, HttpResponseBadRequest
 | 
			
		||||
from django.views.generic import DetailView, FormView, TemplateView
 | 
			
		||||
from django_filters.rest_framework import DjangoFilterBackend
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
 | 
			
		||||
from paperless.db import GnuPG
 | 
			
		||||
from paperless.mixins import SessionOrBasicAuthMixin
 | 
			
		||||
from paperless.views import StandardPagination
 | 
			
		||||
@ -63,8 +65,11 @@ class FetchView(SessionOrBasicAuthMixin, DetailView):
 | 
			
		||||
            self._get_raw_data(self.object.source_file),
 | 
			
		||||
            content_type=content_types[self.object.file_type]
 | 
			
		||||
        )
 | 
			
		||||
        response["Content-Disposition"] = 'attachment; filename="{}"'.format(
 | 
			
		||||
            self.object.file_name)
 | 
			
		||||
 | 
			
		||||
        DISPOSITION = 'inline' if settings.INLINE_DOC else 'attachment'
 | 
			
		||||
 | 
			
		||||
        response["Content-Disposition"] = '{}; filename="{}"'.format(
 | 
			
		||||
            DISPOSITION, self.object.file_name)
 | 
			
		||||
 | 
			
		||||
        return response
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -271,6 +271,9 @@ PASSPHRASE = os.getenv("PAPERLESS_PASSPHRASE")
 | 
			
		||||
PRE_CONSUME_SCRIPT = os.getenv("PAPERLESS_PRE_CONSUME_SCRIPT")
 | 
			
		||||
POST_CONSUME_SCRIPT = os.getenv("PAPERLESS_POST_CONSUME_SCRIPT")
 | 
			
		||||
 | 
			
		||||
# Whether to display a selected document inline, or download it as attachment:
 | 
			
		||||
INLINE_DOC = os.getenv("PAPERLESS_INLINE_DOC")
 | 
			
		||||
 | 
			
		||||
# The number of items on each page in the web UI.  This value must be a
 | 
			
		||||
# positive integer, but if you don't define one in paperless.conf, a default of
 | 
			
		||||
# 100 will be used.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user