@@ -84,26 +84,26 @@ def post(self, request: HttpRequest, *args, **kwargs) -> Response:
8484 job_code = request .data .get ("job_code" ),
8585 name = request .data .get ("name" ),
8686 )
87+
8788 upload_serializer = UploadSerializer (data = upload_data )
8889 if not upload_serializer .is_valid ():
8990 return Response (
9091 upload_serializer .errors , status = status .HTTP_400_BAD_REQUEST
9192 )
92- instance = self .create_upload (upload_serializer , repository , commit , report )
93-
94- repository = instance .report .commit .repository
95- commit = instance .report .commit
9693
97- url = f" { settings . CODECOV_DASHBOARD_URL } / { repository . author . service } / { repository . author . username } / { repository . name } / commit/ { commit . commitid } "
94+ upload = self . create_upload ( upload_serializer , repository , commit , report )
9895
99- archive_service = ArchiveService ( repository )
100- raw_upload_location = archive_service . create_presigned_put (
101- instance . storage_path
102- )
103-
104- if instance :
96+ if upload :
97+ url = f" { settings . CODECOV_DASHBOARD_URL } / { repository . author . service } / { repository . author . username } / { repository . name } /commit/ { commit . commitid } "
98+ archive_service = ArchiveService ( repository )
99+ raw_upload_location = archive_service . create_presigned_put (
100+ upload . storage_path
101+ )
105102 return Response (
106- {"raw_upload_location" : raw_upload_location , "url" : url },
103+ {
104+ "url" : url ,
105+ "raw_upload_location" : raw_upload_location ,
106+ },
107107 status = status .HTTP_201_CREATED ,
108108 )
109109 else :
0 commit comments