Skip to content
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

Trim Version When Parsing #4554

Merged
merged 2 commits into from
Jun 14, 2024
Merged

Trim Version When Parsing #4554

merged 2 commits into from
Jun 14, 2024

Conversation

Trenly
Copy link
Contributor

@Trenly Trenly commented Jun 14, 2024


When parsing a version, it may be possible that a publisher included one or more whitespace characters at the end of the DisplayVersion key. Since a folder name cannot end with a whitespace character, this means that any PackageVersion in the community repository cannot have a trailing whitespace character.

Due to the way versions are parsed, the trailing whitespace gets considered as an "other" of the version part during the version comparison. This means that 5.8 is considered a lower version than 5.8 when parsed.

This PR makes it so that when a version is assigned, as is the case when parsing the installed versions, both the final version and the version parts are trimmed of whitespace. This means that 5.0.13 is now considered equal to 5.0 .13, 5.0.13 , or even 5 . 0 .13

Microsoft Reviewers: Open in CodeFlow

@Trenly Trenly requested a review from a team as a code owner June 14, 2024 03:35
src/AppInstallerSharedLib/Versions.cpp Outdated Show resolved Hide resolved
src/AppInstallerSharedLib/Versions.cpp Outdated Show resolved Hide resolved
src/AppInstallerSharedLib/Versions.cpp Outdated Show resolved Hide resolved
src/AppInstallerSharedLib/Versions.cpp Outdated Show resolved Hide resolved
@JohnMcPMS
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JohnMcPMS JohnMcPMS merged commit 49d1a22 into microsoft:master Jun 14, 2024
8 checks passed
@Trenly Trenly deleted the TrimVersion branch June 14, 2024 21:13
JohnMcPMS pushed a commit that referenced this pull request Jun 14, 2024
When creating #4554 I tested that it functioned manually. After the PR
merged, however, I figured I should probably add some tests for it. I'm
not entirely certain I understand how version parsing truly works, but
figured I'd take a stab at making the tests anyways
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants