Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for Source Argument Validation in SourceWorkflow for Default Sour…
…ce Type (microsoft#4891) Fix for Source Argument Validation in SourceWorkflow for Default Source Type [Issues:] The current validation in the source flow correctly detects duplicate source names. However, when the source argument is validated along with the source type, it allows different source names with the same arguments for the empty source type. This happens because, during source type comparison, if the source type is not provided, it defaults to an empty string, which is compared against the default type (Microsoft.PreIndexed). This allows multiple different source names with the same argument to be considered valid sources. For an empty source type, the default source type is assigned during the source add operation, not beforehand. Consequently, after the source add operation is finished, the source will have some source arguments, but only the name will differ. [Fix:] For an empty source type, we should compare against the default source to prevent different source names with the same arguments for the default types. During validation, we obtain the default type to replace the empty source type and use it for comparison to validate argument duplication. - Extended source tests to validate the duplicate source argument scenario for the default source type. - Fixed additional failing source origin tests with appropriate fixes. [How Validated:] - Compiled the latest modifications and deployed the AppInstallerCLIPackage. - Executed CLI SourceTests to ensure all tests pass without issues. **[Manual validation:]** **Before fix:** ![image](https://github.com/user-attachments/assets/591b3ec2-ae6c-42ac-8258-169596657c4a) **After fix:** ![image](https://github.com/user-attachments/assets/2078b72a-d746-440c-a44e-2ec05c812e26) <!-- To check a checkbox place an "x" between the brackets. e.g: [x] --> - [x] I have signed the [Contributor License Agreement](https://cla.opensource.microsoft.com/microsoft/winget-pkgs). - [ ] This pull request is related to an issue. ----- ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/winget-cli/pull/4891)
- Loading branch information