Skip to content

Commit d10337c

Browse files
committed
Fixed build
1 parent 357739c commit d10337c

2 files changed

Lines changed: 26 additions & 19 deletions

File tree

.github/workflows/tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ jobs:
6565
$cert = New-SelfSignedCertificate -Type CodeSigningCert -Subject "CN=Test" -CertStoreLocation Cert:\CurrentUser\My
6666
$pwd = ConvertTo-SecureString -String "TestPass123" -Force -AsPlainText
6767
Export-PfxCertificate -Cert $cert -FilePath test.pfx -Password $pwd
68+
Export-Certificate -Cert $cert -FilePath test.cer
6869
69-
- name: Test CLI with signing
70+
- name: Add certificate to root store
7071
shell: pwsh
7172
run: |
72-
msixbundle-cli --out-dir ./output-signed --dir-x64 ./test-content-x64 --pfx ./test.pfx --pfx-password TestPass123 --timestamp-url ""
73+
certutil -addstore root test.cer
74+
75+
- name: Test CLI with signing and verification
76+
shell: pwsh
77+
run: |
78+
msixbundle-cli --out-dir ./output-signed --dir-x64 ./test-content-x64 --pfx ./test.pfx --pfx-password TestPass123 --timestamp-url "" --verify
7379
if (!(Test-Path ./output-signed/*.msixbundle)) { exit 1 }

msixbundle/src/lib.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ use std::{
4545
};
4646
use thiserror::Error;
4747

48+
/// Dotted-quad version for SDK folder parsing (e.g., "10.0.19041.0").
49+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
50+
struct Version4(u32, u32, u32, u32);
51+
52+
impl Version4 {
53+
fn parse(s: &str) -> Result<Self, ()> {
54+
let mut it = s.split('.');
55+
let a = it.next().ok_or(())?.parse().map_err(|_| ())?;
56+
let b = it.next().ok_or(())?.parse().map_err(|_| ())?;
57+
let c = it.next().ok_or(())?.parse().map_err(|_| ())?;
58+
let d = it.next().ok_or(())?.parse().map_err(|_| ())?;
59+
if it.next().is_some() {
60+
return Err(());
61+
}
62+
Ok(Self(a, b, c, d))
63+
}
64+
}
65+
4866
/// Errors that can occur during MSIX packaging operations.
4967
#[derive(Debug, Error)]
5068
pub enum MsixError {
@@ -740,23 +758,6 @@ pub fn validate_package(tools: &SdkTools, msix_or_bundle: &Path) -> Result<()> {
740758
mod tests {
741759
use super::*;
742760

743-
// dotted-quad version for SDK folders
744-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
745-
struct Version4(u32, u32, u32, u32);
746-
impl Version4 {
747-
fn parse(s: &str) -> Result<Self, ()> {
748-
let mut it = s.split('.');
749-
let a = it.next().ok_or(())?.parse().map_err(|_| ())?;
750-
let b = it.next().ok_or(())?.parse().map_err(|_| ())?;
751-
let c = it.next().ok_or(())?.parse().map_err(|_| ())?;
752-
let d = it.next().ok_or(())?.parse().map_err(|_| ())?;
753-
if it.next().is_some() {
754-
return Err(());
755-
}
756-
Ok(Self(a, b, c, d))
757-
}
758-
}
759-
760761
#[test]
761762
fn sanitize_removes_invalid_chars() {
762763
assert_eq!(sanitize("My:App"), "MyApp");

0 commit comments

Comments
 (0)