Skip to content

Version extraction in FilenameExposer truncates multi-digit version numbers #134

Description

@elharo

In FilenameExposer.java:35-40, the regex only matches a single digit:

private static final Pattern VERSION_PATTERN = Pattern.compile("-\\\\d");  // only matches single digit!
// ...
identification.addVersion(filename.substring(mat.end() - 1));

For a file like my-lib-12.3.4.jar:

  • mat.find() matches -1 at position 6-8
  • mat.end() - 1 = 7 ⇒ filename.substring(7) = 2.3.4

The expected result is 12.3.4. The pattern -\\\\d only matches - followed by a single digit, so any version starting with a multi-digit number (e.g., 10, 12, 21) gets its first digit lopped off. This produces incorrect artifact identification for versions >= 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:majorMajor loss of function

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions