< prev index next >

src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 426,440 **** // (1) assume all path from zip file itself is "normalized" // (2) IndexNode.name is absolute. see IndexNode(byte[],int,int) // (3) if parent "dir" is relative when ZipDirectoryStream // is created, the returned child path needs to be relative // as well. byte[] cname = child.name; ! if (!dir.isAbsolute()) { ! cname = Arrays.copyOfRange(cname, 1, cname.length); } - ZipPath zpath = new ZipPath(this, cname, true); if (filter == null || filter.accept(zpath)) list.add(zpath); child = child.sibling; } return list.iterator(); --- 426,448 ---- // (1) assume all path from zip file itself is "normalized" // (2) IndexNode.name is absolute. see IndexNode(byte[],int,int) // (3) if parent "dir" is relative when ZipDirectoryStream // is created, the returned child path needs to be relative // as well. + // (4) if parent "dir" starts with './' or is '.' when ZipDirectoryStream + // is created, the returned child path needs to also start + // with './' as well. byte[] cname = child.name; ! ZipPath zpath; ! ! if (dir.isAbsolute()) { ! zpath = new ZipPath(this, cname, true); ! } else { ! ZipPath childPath = new ZipPath(this, cname, true); ! ZipPath childFileName = childPath.getFileName(); ! zpath = dir.resolve(childFileName); } if (filter == null || filter.accept(zpath)) list.add(zpath); child = child.sibling; } return list.iterator();
< prev index next >