Skip to content

Commit b3672ad

Browse files
committed
Add path normalizer to Manifest class
1 parent fbe4168 commit b3672ad

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/EasySign/Bundle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public void AddEntry(string path, string destinationPath = "./", string? rootPat
268268
rootPath = RootPath;
269269

270270
using var file = File.OpenRead(path);
271-
string name = new UnifiedPath.OSPath(Path.GetRelativePath(rootPath, path)).Unix;
271+
string name = Manifest.GetNormalizedEntryName(Path.GetRelativePath(rootPath, path));
272272
var hash = ComputeSHA512Hash(file);
273273

274274
if (Manifest.StoreOriginalFiles && !string.IsNullOrEmpty(destinationPath) && destinationPath != "./")

src/EasySign/Manifest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ public void AddEntry(string entryName, byte[] hash)
6363
throw new InvalidOperationException($"The entry '{entryName}' is already in the manifest.");
6464
}
6565
}
66+
67+
/// <summary>
68+
/// Converts the path to an standard zip entry name
69+
/// </summary>
70+
/// <param name="path">
71+
/// The path to convert.
72+
/// </param>
73+
/// <returns>
74+
/// The normalized entry name.
75+
/// </returns>
76+
public static string GetNormalizedEntryName(string path)
77+
{
78+
return new UnifiedPath.OSPath(path).Unix;
79+
}
6680
}
6781

6882
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata, WriteIndented = false, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]

0 commit comments

Comments
 (0)