Skip to content

Commit efebf20

Browse files
authored
[browser] Fix computing destination sub path and publish extension target path in Wasm SDK (#105458)
1 parent 81976ed commit efebf20

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ public static string GetCandidateRelativePath(ITaskItem candidate, bool fingerpr
107107
{
108108
fileName = Path.GetFileNameWithoutExtension(destinationSubPath);
109109
extension = Path.GetExtension(destinationSubPath);
110-
subPath = destinationSubPath.Substring(fileName.Length + extension.Length);
110+
subPath = Path.GetDirectoryName(destinationSubPath);
111+
if (!string.IsNullOrEmpty(subPath))
112+
subPath += "/";
111113
}
112114

113115
string relativePath;

src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public void WriteBootJson(Stream output, string entryAssemblyName)
336336
resourceList = new();
337337
resourceData.extensions[extensionName] = resourceList;
338338
}
339-
var targetPath = resource.GetMetadata("TargetPath");
339+
var targetPath = endpointByAsset[resource.ItemSpec].ItemSpec;
340340
Debug.Assert(!string.IsNullOrEmpty(targetPath), "Target path for '{0}' must exist.", resource.ItemSpec);
341341
AddResourceToList(resource, resourceList, targetPath);
342342
continue;
@@ -431,7 +431,7 @@ void AddResourceToList(ITaskItem resource, ResourceHashesByNameDictionary resour
431431
{
432432
if (!resourceList.ContainsKey(resourceKey))
433433
{
434-
Log.LogMessage(MessageImportance.Low, "Added resource '{0}' to the manifest.", resource.ItemSpec);
434+
Log.LogMessage(MessageImportance.Low, "Added resource '{0}' with key '{1}' to the manifest.", resource.ItemSpec, resourceKey);
435435
resourceList.Add(resourceKey, $"sha256-{resource.GetMetadata("Integrity")}");
436436
}
437437
}

0 commit comments

Comments
 (0)