MCPcopy
hub / github.com/WebODM/WebODM / get_external_import_tmpdir

Function get_external_import_tmpdir

app/api/tasks.py:821–835  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

819}
820
821def get_external_import_tmpdir(request):
822 uuid = request.data.get('uuid', None)
823 try:
824 uuidmod.UUID(uuid, version=4)
825 tmp_upload_dir = os.path.join(settings.FILE_UPLOAD_TEMP_DIR, f"external-import-{uuid}")
826 if not os.path.isdir(tmp_upload_dir):
827 raise ValueError("Invalid uuid")
828 try:
829 # Just in case
830 path_traversal_check(tmp_upload_dir, settings.FILE_UPLOAD_TEMP_DIR)
831 except SuspiciousFileOperation:
832 raise exceptions.NotFound(_("Invalid uuid"))
833 return tmp_upload_dir
834 except (TypeError, ValueError, AttributeError):
835 raise exceptions.ValidationError(detail=_("Invalid uuid"))
836
837
838class TaskExternalImportUpload(APIView):

Callers 2

postMethod · 0.85
postMethod · 0.85

Calls 3

path_traversal_checkFunction · 0.90
_Function · 0.50
getMethod · 0.45

Tested by

no test coverage detected