diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,9 @@
 # Changelog for pantry
 
+## v0.5.1.1
+
+* Fix to allow mulitiple relative path of symlink.
+
 ## v0.5.1.0
 
 * Catch all exceptions from Casa calls and recover
diff --git a/attic/symlink-to-dir.tar.gz b/attic/symlink-to-dir.tar.gz
Binary files a/attic/symlink-to-dir.tar.gz and b/attic/symlink-to-dir.tar.gz differ
diff --git a/pantry.cabal b/pantry.cabal
--- a/pantry.cabal
+++ b/pantry.cabal
@@ -7,7 +7,7 @@
 -- hash: 156d4b4d6df076864730cb8c7b4cb2c36fa1013a6790ed64c3de504f75bb4d58
 
 name:           pantry
-version:        0.5.1.0
+version:        0.5.1.1
 synopsis:       Content addressable Haskell package management
 description:    Please see the README on Github at <https://github.com/commercialhaskell/pantry#readme>
 category:       Development
diff --git a/src/Pantry/Internal.hs b/src/Pantry/Internal.hs
--- a/src/Pantry/Internal.hs
+++ b/src/Pantry/Internal.hs
@@ -59,11 +59,11 @@
 
   let c2 = filter (\x -> not (T.null x || x == ".")) c1
 
-  let loop [] = []
-      loop (_:"..":rest) = loop rest
-      loop (x:xs) = x : loop xs
+  let loop [] routput = reverse routput
+      loop ("..":rest) (_:routput) = loop rest routput
+      loop (x:xs) routput = loop xs (x:routput)
 
-  case loop c2 of
+  case loop c2 [] of
     [] -> Left "no non-empty components"
     c' -> Right $ T.unpack $ T.intercalate "/" c'
 
diff --git a/test/Pantry/InternalSpec.hs b/test/Pantry/InternalSpec.hs
--- a/test/Pantry/InternalSpec.hs
+++ b/test/Pantry/InternalSpec.hs
@@ -26,6 +26,7 @@
     "/test/file/../bob/fred" ! Nothing
     "test/file/../bob/fred/" ! Just "test/bob/fred"
     "test/file/../bob/fred" ! Just "test/bob/fred"
+    "test0/test1/file/../../bob/fred" ! Just "test0/bob/fred"
     "../bob/fred" ! Nothing
     "../bob/fred/" ! Nothing
     "./bob/fred/" ! Just "bob/fred"
