Skip to content
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

Fixes https://github.com/NuGet/Home/issues/1157 #19

Closed
wants to merge 1 commit into from
Closed
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 @@ -112,6 +112,8 @@ await ConcurrencyUtilities.ExecuteWithFileLocked(targetNupkg,
// Now rename the tmp file
File.Move(targetTempNupkg, targetNupkg);

var tempHashPath = Path.Combine(hashPath, Path.GetRandomFileName());

using (var nupkgStream = File.Open(targetNupkg, FileMode.Open, FileAccess.Read, FileShare.Read))
{
string packageHash;
Expand All @@ -122,7 +124,10 @@ await ConcurrencyUtilities.ExecuteWithFileLocked(targetNupkg,

// Note: PackageRepository relies on the hash file being written out as the
// final operation as part of a package install to assume a package was fully installed.
File.WriteAllText(hashPath, packageHash);
File.WriteAllText(tempHashPath, packageHash);

// Rename the tmp hash file
File.Move(tempHashPath, hashPath);
}

log.LogVerbose($"Completed installation of {packageIdentity.Id} {packageIdentity.Version}");
Expand Down