<< Back to previous view

[CLASSPATH-4] clojure.java.classpath/classpath gives bogus %20 paths when there are spaces in the pathnames Created: 12/Dec/12  Updated: 18/Jan/13  Resolved: 18/Jan/13

Status: Closed
Project: java.classpath
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Tim McCormack Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-CLASSPATH-4-Use-io-as-file-instead-of-treating-URL-a.patch    


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])

Expected results:

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

Actual results:

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

Comment by Tim McCormack [ 12/Dec/12 11:02 PM ]

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

#(java.io.File. (.getPath ^java.net.URL %))
Comment by Tim McCormack [ 13/Dec/12 5:39 PM ]

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

Comment by Tim McCormack [ 11/Jan/13 3:10 PM ]

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

Comment by Stuart Sierra [ 18/Jan/13 8:58 AM ]


Generated at Mon Jan 22 06:39:10 CST 2018 using JIRA 4.4#649-r158309.