From 35339eaa4600b8312a4f40e70004f0a8b06c61d0 Mon Sep 17 00:00:00 2001 From: caesay Date: Tue, 26 Dec 2023 00:46:31 +0000 Subject: [PATCH] Patch osx tests --- .github/workflows/build.yml | 2 +- src/Squirrel.Csq/Squirrel.Csq.csproj | 8 +++++--- src/Squirrel/ReleaseEntry.cs | 4 ++++ test/Squirrel.Tests/UtilityTests.cs | 9 ++++++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d6bd74b..41593389 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,7 +109,7 @@ jobs: path: src/Rust/target/release - name: Build .NET - run: dotnet build -c Release + run: dotnet build -c Release /p:PackRustAssets=true - name: Upload Package Artifacts uses: actions/upload-artifact@v3 diff --git a/src/Squirrel.Csq/Squirrel.Csq.csproj b/src/Squirrel.Csq/Squirrel.Csq.csproj index 289713bd..ea5cf65e 100644 --- a/src/Squirrel.Csq/Squirrel.Csq.csproj +++ b/src/Squirrel.Csq/Squirrel.Csq.csproj @@ -22,14 +22,16 @@ - - + + + - + + diff --git a/src/Squirrel/ReleaseEntry.cs b/src/Squirrel/ReleaseEntry.cs index 2a5797be..101bac6f 100644 --- a/src/Squirrel/ReleaseEntry.cs +++ b/src/Squirrel/ReleaseEntry.cs @@ -182,6 +182,10 @@ namespace Squirrel throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name"); } + if (filename.IndexOfAny(new[] { '\"', '/', '\\', '<', '>', '|', '\0' }) > -1) { + throw new Exception("Filename can either be an absolute HTTP[s] URL, *or* a file name"); + } + long size = Int64.Parse(m.Groups[3].Value); return new ReleaseEntry(m.Groups[1].Value, filename, size, baseUrl, query, stagingPercentage); } diff --git a/test/Squirrel.Tests/UtilityTests.cs b/test/Squirrel.Tests/UtilityTests.cs index 7f75a939..94305134 100644 --- a/test/Squirrel.Tests/UtilityTests.cs +++ b/test/Squirrel.Tests/UtilityTests.cs @@ -24,7 +24,7 @@ namespace Squirrel.Tests _output = output; } - [Theory] + [SkippableTheory] [InlineData("file.txt", "file.txt")] [InlineData("file", "file")] [InlineData("/file", "\\file")] @@ -33,12 +33,13 @@ namespace Squirrel.Tests [InlineData("C:/AnApp/file/", "C:\\AnApp\\file")] public void PathIsNormalized(string input, string expected) { + Skip.IfNot(SquirrelRuntimeInfo.IsWindows); var exp = Path.GetFullPath(expected); var normal = Utility.NormalizePath(input); Assert.Equal(exp, normal); } - [Theory] + [SkippableTheory] [InlineData("C:\\AnApp", "C:\\AnApp\\file.exe", true)] [InlineData("C:\\AnApp\\", "C:\\AnApp\\file.exe", true)] [InlineData("C:\\AnApp", "C:\\AnApp\\sub\\dir\\file.exe", true)] @@ -50,6 +51,7 @@ namespace Squirrel.Tests [InlineData("AnAppThree", "AnAppThree\\file.exe", true)] public void FileIsInDirectory(string directory, string file, bool isIn) { + Skip.IfNot(SquirrelRuntimeInfo.IsWindows); var fileInDir = Utility.IsFileInDirectory(file, directory); Assert.Equal(isIn, fileInDir); } @@ -172,13 +174,14 @@ namespace Squirrel.Tests Assert.Equal(result, Utility.FileIsLikelyPEImage(input)); } - [Theory] + [SkippableTheory] [InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", true)] [InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)] [InlineData("C:\\Users\\bob\\temp\\pkgPath\\lib\\net45\\node_modules\\foo\\foo.exe", "C:\\Users\\bob\\temp\\pkgPath", false)] [InlineData("foo.png", "C:\\Users\\bob\\temp\\pkgPath", false)] public void IsFileTopLevelInPackageTest(string input, string packagePath, bool result) { + Skip.IfNot(SquirrelRuntimeInfo.IsWindows); Assert.Equal(result, Utility.IsFileTopLevelInPackage(input, packagePath)); }