You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2015/03/28 20:16:06 UTC
ant git commit: COMPRESS-312 normalize filename in TarEntry's (File,
String) constructor
Repository: ant
Updated Branches:
refs/heads/master 06bdb4521 -> 71715055c
COMPRESS-312 normalize filename in TarEntry's (File, String) constructor
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/71715055
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/71715055
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/71715055
Branch: refs/heads/master
Commit: 71715055cd0a9a993d91159d0aa49e5eee13d935
Parents: 06bdb45
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sat Mar 28 20:15:36 2015 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sat Mar 28 20:15:36 2015 +0100
----------------------------------------------------------------------
WHATSNEW | 3 +++
src/main/org/apache/tools/tar/TarEntry.java | 13 +++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/71715055/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 82f78ac..187bd2b 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -81,6 +81,9 @@ Fixed bugs:
when tasks spawned new child threads that accessed the properties.
Bugzilla Report 55074
+ * TarArchiveEntry's constructor with a File and a String arg didn't
+ normalize the name.
+
Other changes:
--------------
http://git-wip-us.apache.org/repos/asf/ant/blob/71715055/src/main/org/apache/tools/tar/TarEntry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarEntry.java b/src/main/org/apache/tools/tar/TarEntry.java
index 0bfc926..dc9b64e 100644
--- a/src/main/org/apache/tools/tar/TarEntry.java
+++ b/src/main/org/apache/tools/tar/TarEntry.java
@@ -257,7 +257,7 @@ public class TarEntry implements TarConstants {
* @param file The file that the entry represents.
*/
public TarEntry(File file) {
- this(file, normalizeFileName(file.getPath(), false));
+ this(file, file.getPath());
}
/**
@@ -270,6 +270,7 @@ public class TarEntry implements TarConstants {
public TarEntry(File file, String fileName) {
this();
+ String normalizedName = normalizeFileName(fileName, false);
this.file = file;
this.linkName = "";
@@ -278,18 +279,18 @@ public class TarEntry implements TarConstants {
this.mode = DEFAULT_DIR_MODE;
this.linkFlag = LF_DIR;
- int nameLength = fileName.length();
- if (nameLength == 0 || fileName.charAt(nameLength - 1) != '/') {
- this.name = fileName + "/";
+ int nameLength = normalizedName.length();
+ if (nameLength == 0 || normalizedName.charAt(nameLength - 1) != '/') {
+ this.name = normalizedName + "/";
} else {
- this.name = fileName;
+ this.name = normalizedName;
}
this.size = 0;
} else {
this.mode = DEFAULT_FILE_MODE;
this.linkFlag = LF_NORMAL;
this.size = file.length();
- this.name = fileName;
+ this.name = normalizedName;
}
this.modTime = file.lastModified() / MILLIS_PER_SECOND;