Skip to content

Commit d23a6a0

Browse files
authored
fix: retrieving repoid through commit report can yield error (#1132)
1 parent a12b039 commit d23a6a0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

upload/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def create(self, validated_data: Dict[str, Any]) -> ReportSession | None:
7171
flag_names = (
7272
validated_data.pop("flags") if "flags" in validated_data.keys() else []
7373
)
74+
repoid = validated_data.pop("repo_id", None)
7475

7576
# default is necessary here, or else if the key is not in the dict
7677
# the below will throw a KeyError
@@ -81,7 +82,6 @@ def create(self, validated_data: Dict[str, Any]) -> ReportSession | None:
8182
flags = []
8283

8384
if upload:
84-
repoid = upload.report.commit.repository.repoid
8585
existing_flags_map = self._create_existing_flags_map(repoid)
8686
for individual_flag in flag_names:
8787
flag_obj = existing_flags_map.get(individual_flag, None)

upload/views/uploads.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ def create_upload(
7272
serializer.validated_data["storage_path"] = path
7373
# Create upload record
7474
instance: ReportSession = serializer.save(
75-
report_id=report.id, upload_extras={"format_version": "v1"}, state="started"
75+
repo_id=repository.repoid,
76+
report_id=report.id,
77+
upload_extras={"format_version": "v1"},
78+
state="started",
7679
)
7780

7881
# Inserts mirror upload record into measurements table. CLI hits this endpoint

0 commit comments

Comments
 (0)