diff --git a/src/com/google/javascript/jscomp/SourceFile.java b/src/com/google/javascript/jscomp/SourceFile.java index 6fc349ce34c..e740cb6af5a 100644 --- a/src/com/google/javascript/jscomp/SourceFile.java +++ b/src/com/google/javascript/jscomp/SourceFile.java @@ -46,6 +46,7 @@ import java.util.Arrays; import java.util.Enumeration; import java.util.List; +import java.util.regex.Pattern; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -358,13 +359,14 @@ public static List fromZipFile(String zipName, Charset inputCharset) private static final String JAR_URL_PREFIX = "jar:file:"; private static boolean isZipEntry(String path) { - return path.contains(".zip!/") && (path.endsWith(".js") || path.endsWith(".js.map")); + return path.contains(".zip!" + File.separator) + && (path.endsWith(".js") || path.endsWith(".js.map")); } @GwtIncompatible("java.io.File") private static SourceFile fromZipEntry(String zipURL, Charset inputCharset) { checkArgument(isZipEntry(zipURL)); - String[] components = zipURL.split(BANG_SLASH); + String[] components = zipURL.split(Pattern.quote(BANG_SLASH.replace("/", File.separator))); try { String zipPath = components[0]; String relativePath = components[1]; @@ -378,7 +380,8 @@ private static SourceFile fromZipEntry(String zipURL, Charset inputCharset) { public static SourceFile fromZipEntry( String originalZipPath, String absoluteZipPath, String entryPath, Charset inputCharset) throws MalformedURLException { - String zipEntryPath = JAR_URL_PREFIX + absoluteZipPath + BANG_SLASH + entryPath; + String zipEntryPath = + JAR_URL_PREFIX + absoluteZipPath + BANG_SLASH + entryPath.replace(File.separator, "/"); URL zipEntryUrl = new URL(zipEntryPath); return builder()