Skip to content

Use WinGet repository manifest path for 'Learn more' #3999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
Expand Down Expand Up @@ -150,7 +151,7 @@ public PackageViewModel(
/// For packages from winget or custom catalogs:
/// 1. Use package url
/// 2. Else, use publisher url
/// 3. Else, use "https://github.com/microsoft/winget-pkgs"
/// 3. Else, use the folder path of the manifest in microsoft/winget-pkgs repository
///
/// For packages from ms store catalog:
/// 1. Use package url
Expand All @@ -174,7 +175,7 @@ public Uri GetLearnMoreUri()
return _package.PublisherUrl;
}

return new Uri("https://github.com/microsoft/winget-pkgs");
return new Uri(GetWinGetRepositoryManifestPath());
}

partial void OnIsSelectedChanged(bool value) => SelectionChanged?.Invoke(this, value);
Expand Down Expand Up @@ -261,6 +262,13 @@ private string GetPackageFullDescription()
return CatalogName;
}

private string GetWinGetRepositoryManifestPath()
{
var initial = _package.Id.First().ToString().ToLowerInvariant();
var packageChildPath = _package.Id.Replace('.', '/');
return $"https://github.com/microsoft/winget-pkgs/tree/master/manifests/{initial}/{packageChildPath}";
}

/// <summary>
/// Indicates if a specific version of the package can be selected to install
/// </summary>
Expand Down