From c161d4be9b5b2aed1d8454196aacd548ad3cd55a Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 24 Apr 2015 17:21:23 +0200 Subject: [PATCH] Fix StackOverflowException when using local path - fixes #795 --- RELEASE_NOTES.md | 3 +++ src/Paket.Core/NuGetV2.fs | 5 ++++- src/Paket.Core/NupkgWriter.fs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 598d79965f..16917e61ce 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 1.1.3 - 24.04.2015 +* Fix StackOverflowException when using local path - https://github.com/fsprojects/Paket/issues/795 + #### 1.1.2 - 24.04.2015 * `paket add` should not change dependencies file if the package is misspelled - https://github.com/fsprojects/Paket/issues/798 diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index 2e235e5023..981c1cc50f 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -320,7 +320,10 @@ let getDetailsFromLocalFile root localNugetPath package (version:SemVerInfo) = if not nupkg.Exists then failwithf "The package %s %s can't be found in %s.%sPlease check the feed definition in your paket.dependencies file." package (version.ToString()) di.FullName Environment.NewLine - let zip = ZipFile.OpenRead(nupkg.FullName) + + use zipToCreate = new FileStream(nupkg.FullName, FileMode.Open) + use zip = new ZipArchive(zipToCreate,ZipArchiveMode.Read) + let zippedNuspec = zip.Entries |> Seq.find (fun f -> f.FullName.EndsWith ".nuspec") let fileName = FileInfo(Path.Combine(Path.GetTempPath(), zippedNuspec.Name)).FullName diff --git a/src/Paket.Core/NupkgWriter.fs b/src/Paket.Core/NupkgWriter.fs index d43b9eedb9..e47109ace5 100644 --- a/src/Paket.Core/NupkgWriter.fs +++ b/src/Paket.Core/NupkgWriter.fs @@ -17,7 +17,7 @@ let contentTypeDoc fileList = let ns = XNamespace.Get "http://schemas.openxmlformats.org/package/2006/content-types" let root = XElement(ns + "Types") - let defaultNode extension contentType = + let defaultNode extension contentType = let def = XElement(ns + "Default") def.SetAttributeValue(XName.Get "Extension", extension) def.SetAttributeValue(XName.Get "ContentType", contentType)