eolivelli commented on a change in pull request #3: [MWAR-371] Overlays break
first-win rule for web resource with target path ending with '/'
URL: https://github.com/apache/maven-war-plugin/pull/3#discussion_r243770381
##########
File path: src/main/java/org/apache/maven/plugins/war/util/PathSet.java
##########
@@ -46,21 +47,16 @@
/**
* Set of normalized paths
*/
- private Set<String> pathsSet = new LinkedHashSet<String>();
+ private Set<String> pathsSet = new LinkedHashSet<>();
- /**
- * The method normalizes the path.
- * <ul>
- * <li>changes directory separator to unix's separator(/)</li>
- * <li>deletes all trailing slashes</li>
- * </ul>
- *
- * @param path to normalization
- * @return normalized path
- */
- protected String normalizeFilePath( String path )
+ static String normalizeSubPath( String path )
{
- return normalizeFilePathStatic( path );
+ if ( path.isEmpty() )
+ {
+ return path;
+ }
+ final String cleanPath = Paths.get( StringUtils.replace( path, '\\',
'/' ) ).toString();
Review comment:
Here we are assuming that 'path' is an absolute path or it is relative to
the current directory of the JVM, is this true?
Won't we have problems with mounts/payh traversals...?
It seems to be that previous code was only operating on strings, not on
filesystem.
Do I miss something?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services