MCPcopy
hub / github.com/1Panel-dev/MaxKB / upload

Method upload

apps/tools/serializers/tool.py:1530–1538  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1528 workspace_id = serializers.CharField(required=True, label=_("workspace id"))
1529
1530 def upload(self):
1531 self.is_valid()
1532 file = self.data.get("file")
1533 if not file.name.endswith(".zip"):
1534 raise AppApiException(1001, _("Unsupported file format"))
1535 file_id = uuid.uuid7()
1536 file = File(id=file_id, file_name=self.data.get("file").name, meta={})
1537 file.save(self.data.get("file").read())
1538 return file_id
1539
1540 class DownloadSkillFile(serializers.Serializer):
1541 user_id = serializers.UUIDField(required=True, label=_("User ID"))

Callers 1

putMethod · 0.45

Calls 6

saveMethod · 0.95
AppApiExceptionClass · 0.90
FileClass · 0.90
readMethod · 0.80
is_validMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected