java.classpath

clojure.java.classpath/classpath gives bogus %20 paths when there are spaces in the pathnames

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Reproduce: In a directory called "foo bar", create this project file:

(defproject test-proj "1.0.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/java.classpath "0.2.0"]])

In the REPL:

(require '[clojure.java.classpath :as cp])
(cp/classpath)

Expected results:

(... #<File /home/timmc/foo bar/src> ...)

Actual results:

(... #<File /home/timmc/foo%20bar/src> ...)

Activity

Hide
Tim McCormack added a comment -

This seems to be the result of how loader-classpath handles URL -> File conversion:

#(java.io.File. (.getPath ^java.net.URL %))
Show
Tim McCormack added a comment - This seems to be the result of how loader-classpath handles URL -> File conversion:
#(java.io.File. (.getPath ^java.net.URL %))
Hide
Tim McCormack added a comment -

I think using clojure.java.io/as-file would be sufficient to handle this conversion properly.

Show
Tim McCormack added a comment - I think using clojure.java.io/as-file would be sufficient to handle this conversion properly.
Hide
Tim McCormack added a comment -

Attached patch uses clojure.java.io/as-file to handle URL -> File conversion.

Show
Tim McCormack added a comment - Attached patch uses clojure.java.io/as-file to handle URL -> File conversion.
Hide
Stuart Sierra added a comment -

applied

Show
Stuart Sierra added a comment - applied

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: