Skip to content

Commit 0ab2d09

Browse files
author
David Pierson
committed
Z-1654 Escape characters were excluded in NameFilter.SplitQuoted
1 parent 3eceb02 commit 0ab2d09

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/Core/NameFilter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
// obligated to do so. If you do not wish to do so, delete this
3434
// exception statement from your version.
3535

36+
// HISTORY
37+
// 2010-03-03 Z-1654 Fixed bug where escape characters were excluded in SplitQuoted()
3638

3739
using System;
3840
using System.Collections;
@@ -158,6 +160,9 @@ public static string[] SplitQuoted(string original)
158160
throw new ArgumentException("Missing terminating escape character", "original");
159161
#endif
160162
}
163+
// include escape if this is not an escaped separator
164+
if (Array.IndexOf(separators, original[endIndex]) < 0)
165+
b.Append(escape);
161166

162167
b.Append(original[endIndex]);
163168
}

tests/Zip/ZipTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,7 @@ public class FastZipHandling : ZipBase
25982598
[Category("CreatesTempFile")]
25992599
public void Basics()
26002600
{
2601-
const string tempName1 = "a.dat";
2601+
const string tempName1 = "a(1).dat";
26022602

26032603
MemoryStream target = new MemoryStream();
26042604

@@ -2610,7 +2610,7 @@ public void Basics()
26102610

26112611
try {
26122612
FastZip fastZip = new FastZip();
2613-
fastZip.CreateZip(target, tempFilePath, false, @"a\.dat", null);
2613+
fastZip.CreateZip(target, tempFilePath, false, @"a\(1\)\.dat", null);
26142614

26152615
MemoryStream archive = new MemoryStream(target.ToArray());
26162616
using (ZipFile zf = new ZipFile(archive)) {

0 commit comments

Comments
 (0)