Skip to content

Commit d2be5ea

Browse files
committed
Be paranoid
1 parent 0d4030f commit d2be5ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sentry/scm/private/providers/gitlab.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,13 +627,15 @@ def make_result[T](
627627

628628

629629
def map_repository(raw: dict[str, Any]) -> GitRepository:
630+
statistics = raw.get("statistics")
631+
repo_size = statistics.get("repository_size", 0) if statistics else 0
630632
return GitRepository(
631633
full_name=raw["path_with_namespace"],
632634
default_branch=raw["default_branch"],
633635
clone_url=raw["http_url_to_repo"],
634636
private=raw["visibility"] != "public",
635637
# GitLab returns size in bytes. We convert to kB to match GitHub
636-
size=raw["statistics"]["repository_size"] // 1000,
638+
size=repo_size // 1000,
637639
)
638640

639641

0 commit comments

Comments
 (0)