Skip to content

Make SingleFile BundleID the expected length (12 bytes) #116656

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ private enum HeaderFlags : ulong
// with path-names so that the AppHost can use it in
// extraction path.
public string BundleID { get; private set; }
//Same as Path.GetRandomFileName
private const int BundleIdLength = 12;
private const int BundleIdLength = 32;
private SHA256 bundleHash = SHA256.Create();
public readonly uint BundleMajorVersion;
// The Minor version is currently unused, and is always zero
Expand Down Expand Up @@ -134,7 +133,7 @@ private string GenerateDeterministicId()
bundleHash.Dispose();
bundleHash = null;

return Convert.ToBase64String(manifestHash).Substring(BundleIdLength).Replace('/', '_');
return Convert.ToBase64String(manifestHash).Substring(0, BundleIdLength).Replace('/', '_');
}

public long Write(BinaryWriter writer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Debug.Assert(BundleID.Length == BundleIdLength) after we set it below?

Expand Down