|
22 | 22 | from rest_framework.permissions import IsAuthenticated, AllowAny |
23 | 23 | from rest_framework.response import Response |
24 | 24 | from rest_framework.viewsets import GenericViewSet |
25 | | -from rest_framework.parsers import MultiPartParser |
26 | 25 | from rest_framework.exceptions import PermissionDenied |
27 | 26 |
|
28 | 27 | from api import monitor, models, permissions, serializers, viewsets, authentication |
|
40 | 39 | from api import admissions, utils, filer |
41 | 40 | from api.backend import OauthCacheManager |
42 | 41 | from api.apps_extra.social_core.actions import do_auth, do_complete |
| 42 | +from api.files.parsers import FilerUploadParser |
43 | 43 |
|
44 | 44 | User = get_user_model() |
45 | 45 | logger = logging.getLogger(__name__) |
@@ -896,7 +896,7 @@ def path(self, request, *args, **kwargs): |
896 | 896 | class AppFilerClientViewSet(AppResourceViewSet): |
897 | 897 | """RESTful views for volumes apps with collaborators.""" |
898 | 898 | model = models.volume.Volume |
899 | | - parser_classes = [MultiPartParser] |
| 899 | + parser_classes = [FilerUploadParser] |
900 | 900 |
|
901 | 901 | def get_client(self): |
902 | 902 | volume = get_object_or_404( |
@@ -926,9 +926,9 @@ def retrieve(self, request, **kwargs): |
926 | 926 | ) |
927 | 927 |
|
928 | 928 | def create(self, request, **kwargs): |
929 | | - path = request.data.get('path', '') |
930 | 929 | client = self.get_client() |
931 | | - response = client.post(path, files=request.FILES) |
| 930 | + file = request.data['file'] |
| 931 | + response = client.post(file.filepath, files=request.FILES) |
932 | 932 | return Response(data=response.content, status=response.status_code) |
933 | 933 |
|
934 | 934 | def destroy(self, request, **kwargs): |
|
0 commit comments