LicenseFinder icon indicating copy to clipboard operation
LicenseFinder copied to clipboard

Pathname with spaces is not properly escaped

Open sebastian-zarzycki opened this issue 1 year ago • 2 comments

I was trying to run a report for a Maven project that existed in a directory with space in it. It detected that it was MVN properly, but exited with error saying that MVN is not installed (even if it is and the wrapper is in the dir). After some debugging I've discovered that it was cutting the path at the space level and thus couldn't find the binary for command. I.e. in https://github.com/pivotal/LicenseFinder/blob/master/lib/license_finder/package_managers/maven.rb, but I would imagine it's similar in other places.

    def package_management_command
      wrapper = File.join(project_path, Platform.windows? ? 'mvnw.cmd' : 'mvnw')
      maven = 'mvn'

      File.exist?(wrapper) ? wrapper : maven
    end

If the project path was /Users/Sebastian/Documents/Workspaces/IntelliJ IDEA/my-project, the project_path value at this stage was/Users/Sebastian/Documents/Workspaces/IntelliJ .

sebastian-zarzycki avatar Sep 28 '23 13:09 sebastian-zarzycki

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Sep 28 '23 13:09 cf-gitbot

Hey @sebastian-zarzycki ! Thanks for raising this. We are very short on resources so if you could make a PR for this we can get a fix in!

xtreme-shane-lattanzio avatar Jan 24 '24 16:01 xtreme-shane-lattanzio