Maven Shared Components

FilteringUtils.escapeWindowsPath doesn't handle paths that leave out the drive letter.

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: maven-filtering-1.0-beta-3
  • Fix Version/s: None
  • Component/s: maven-filtering
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    2

Description

FilteringUtils.escapeWindowsPath requires a drive letter to be present in the path, or at least the string

":\\"
to be present in order to trigger escaping the value as a windows path.

In cases where the path is an absolute reference to a file on the current drive (no drive letter is included), or when the path starts with an unresolved expression (in cases where n+1 level interpolation will eventually resolve the expression), escaping doesn't happen at all.

Issue Links

Activity

Hide
John Casey added a comment -

a patch containing the unit tests for three use cases: complete absolute windows path, windows path absolute from current drive, and windows path starting with an unresolved expression. Also contains a simplistic solution to assume anything with a backslash is a windows path. I'm fairly certain we'll want something more fine-grained than this, but not sure how to address it yet.

Show
John Casey added a comment - a patch containing the unit tests for three use cases: complete absolute windows path, windows path absolute from current drive, and windows path starting with an unresolved expression. Also contains a simplistic solution to assume anything with a backslash is a windows path. I'm fairly certain we'll want something more fine-grained than this, but not sure how to address it yet.
Hide
John Casey added a comment -

pushing this issue, as I'm not sure how to fix this for relative windows paths without messing up cases where the value is not meant to be a relative windows path, but happens to contain a backslash...

Show
John Casey added a comment - pushing this issue, as I'm not sure how to fix this for relative windows paths without messing up cases where the value is not meant to be a relative windows path, but happens to contain a backslash...
Hide
Kathy Hale added a comment -

It's funny you say that because I have the opposite problem. I'm using this bug to disable the auto trigger because I couldn't find any way to disable it. So if I need a path to remain unescaped (single backslashes, not doubled), I've been breaking up the filter param like "${drive}${path}", such that ${drive} is "C:" and {{${path}}} is "\path."

Show
Kathy Hale added a comment - It's funny you say that because I have the opposite problem. I'm using this bug to disable the auto trigger because I couldn't find any way to disable it. So if I need a path to remain unescaped (single backslashes, not doubled), I've been breaking up the filter param like "${drive}${path}", such that ${drive} is "C:" and {{${path}}} is "\path."
Hide
Dennis Lundberg added a comment -

In r1055372 I committed the test case submitted by John Casey, but with the two failing tests commented out.

Show
Dennis Lundberg added a comment - In r1055372 I committed the test case submitted by John Casey, but with the two failing tests commented out.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: