|
@@ -4,6 +4,7 @@ import typing
|
4
|
4
|
import transaction
|
5
|
5
|
from depot.io.local import LocalStoredFile
|
6
|
6
|
from depot.manager import DepotManager
|
|
7
|
+from preview_generator.exception import UnavailablePreviewType
|
7
|
8
|
from pyramid.config import Configurator
|
8
|
9
|
from pyramid.response import FileResponse, FileIter
|
9
|
10
|
|
|
@@ -129,6 +130,7 @@ class FileController(Controller):
|
129
|
130
|
@hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
|
130
|
131
|
@require_workspace_role(UserRoleInWorkspace.READER)
|
131
|
132
|
@require_content_types([file_type])
|
|
133
|
+ @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
|
132
|
134
|
@hapic.input_query(PageQuerySchema())
|
133
|
135
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
134
|
136
|
@hapic.output_file([])
|
|
@@ -156,6 +158,7 @@ class FileController(Controller):
|
156
|
158
|
@hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
|
157
|
159
|
@require_workspace_role(UserRoleInWorkspace.READER)
|
158
|
160
|
@require_content_types([file_type])
|
|
161
|
+ @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
|
159
|
162
|
@hapic.input_path(WorkspaceAndContentIdPathSchema())
|
160
|
163
|
@hapic.output_file([])
|
161
|
164
|
def preview_pdf_full(self, context, request: TracimRequest, hapic_data=None):
|
|
@@ -177,6 +180,7 @@ class FileController(Controller):
|
177
|
180
|
@hapic.with_api_doc(tags=[FILE_ENDPOINTS_TAG])
|
178
|
181
|
@require_workspace_role(UserRoleInWorkspace.READER)
|
179
|
182
|
@require_content_types([file_type])
|
|
183
|
+ @hapic.handle_exception(UnavailablePreviewType, HTTPStatus.BAD_REQUEST)
|
180
|
184
|
@hapic.input_path(WorkspaceAndContentRevisionIdPathSchema())
|
181
|
185
|
@hapic.input_query(PageQuerySchema())
|
182
|
186
|
@hapic.output_file([])
|