@@ -1131,28 +1131,33 @@ class PackagePageData {
11311131 bool get isLatestStable => version.version == package.latestVersion;
11321132
11331133 late final packageLinks = () {
1134- // start with the URLs from pubspec.yaml
1134+ // If the repository failed the verification tests, we are not displaying
1135+ // any links.
1136+ final result = scoreCard.panaReport? .result;
1137+ final repositoryStatus = result? .repositoryStatus;
1138+ if (repositoryStatus == RepositoryStatus .failed) {
1139+ return PackageLinks ._();
1140+ }
1141+
1142+ // If the analysis completed, return the URLs from it.
1143+ if (result != null ) {
1144+ return PackageLinks ._(
1145+ homepageUrl: result.homepageUrl,
1146+ repositoryUrl: result.repositoryUrl,
1147+ issueTrackerUrl: result.issueTrackerUrl,
1148+ documentationUrl: result.documentationUrl,
1149+ contributingUrl: result.contributingUrl,
1150+ );
1151+ }
1152+
1153+ // Fallback: if the analysis did not complete yet, display inferred URLs from pubspec.yaml
11351154 final pubspec = version.pubspec! ;
1136- final inferred = PackageLinks .infer (
1155+ return PackageLinks .infer (
11371156 homepageUrl: pubspec.homepage,
11381157 documentationUrl: pubspec.documentation,
11391158 repositoryUrl: pubspec.repository,
11401159 issueTrackerUrl: pubspec.issueTracker,
11411160 );
1142-
1143- // Use verified URLs when they are available.
1144- final result = scoreCard.panaReport? .result;
1145- if (result == null ) {
1146- return inferred;
1147- }
1148-
1149- return PackageLinks ._(
1150- homepageUrl: result.homepageUrl ?? inferred.homepageUrl,
1151- repositoryUrl: result.repositoryUrl ?? inferred.repositoryUrl,
1152- issueTrackerUrl: result.issueTrackerUrl ?? inferred.issueTrackerUrl,
1153- documentationUrl: result.documentationUrl ?? inferred.documentationUrl,
1154- contributingUrl: result.contributingUrl ?? inferred.contributingUrl,
1155- );
11561161 }();
11571162
11581163 /// The URL resolver using a verified repository
0 commit comments