Downloads a task asset (if available)
(self, request, pk=None, project_pk=None, unsafe_asset_path="")
| 666 | """ |
| 667 | class TaskAssets(TaskNestedView): |
| 668 | def get(self, request, pk=None, project_pk=None, unsafe_asset_path=""): |
| 669 | """ |
| 670 | Downloads a task asset (if available) |
| 671 | """ |
| 672 | task = self.get_and_check_task(request, pk) |
| 673 | |
| 674 | # Check for directory traversal attacks |
| 675 | try: |
| 676 | asset_path = path_traversal_check(task.assets_path(unsafe_asset_path), task.assets_path("")) |
| 677 | except SuspiciousFileOperation: |
| 678 | raise exceptions.NotFound(_("Asset does not exist")) |
| 679 | |
| 680 | if (not os.path.exists(asset_path)) or os.path.isdir(asset_path): |
| 681 | raise exceptions.NotFound(_("Asset does not exist")) |
| 682 | |
| 683 | return download_file_response(request, asset_path, 'inline') |
| 684 | |
| 685 | """ |
| 686 | Task backup endpoint |
no test coverage detected