File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434// exception statement from your version.
3535
3636// HISTORY
37- // 28-01-2010 DavidPierson Added IsStreamOwner
37+ // 2010-01-28 Added IsStreamOwner
38+ // 2012-06-07 Z-1675 RootPath was case and slash direction sensitive; trailing slash caused failure
3839
3940using System ;
4041using System . IO ;
@@ -315,8 +316,8 @@ public string RootPath
315316 if ( isDisposed ) {
316317 throw new ObjectDisposedException ( "TarArchive" ) ;
317318 }
318-
319- rootPath = value ;
319+ // Convert to forward slashes for matching. Trim trailing / for correct final path
320+ rootPath = value . Replace ( ' \\ ' , '/' ) . TrimEnd ( '/' ) ;
320321 }
321322 }
322323
@@ -727,7 +728,7 @@ void WriteEntryCore(TarEntry sourceEntry, bool recurse)
727728 string newName = null ;
728729
729730 if ( rootPath != null ) {
730- if ( entry . Name . StartsWith ( rootPath ) ) {
731+ if ( entry . Name . StartsWith ( rootPath , StringComparison . OrdinalIgnoreCase ) ) {
731732 newName = entry . Name . Substring ( rootPath . Length + 1 ) ;
732733 }
733734 }
You can’t perform that action at this time.
0 commit comments