Permalink
Browse files

Work around bug in java.net.URI for resolving against query string

  • Loading branch information...
1 parent 60f3226 commit d55dea8b540cdb2590879d963915fb936802e5d3 @niklasl committed Apr 11, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/rdfa/core.clj
View
@@ -35,7 +35,13 @@
(defn resolve-iri [iref base]
(if (not-empty iref)
- (.. (java.net.URI. base) (resolve iref) (normalize) (toString))
+ ; NOTE: work around bug in java.net.URI for resolving against query string
+ ; See e.g. org.apache.http.client.utils.
+ ; URIUtils#resolveReferenceStartingWithQueryString
+ (if (.startsWith iref "?")
+ (str (let [i (.indexOf base "?")]
+ (if (> i -1) (subs base 0 i) base)) iref)
+ (.. (java.net.URI. base) (resolve iref) (normalize) (toString)))
base))
(defn to-iri [s base]

0 comments on commit d55dea8

Please sign in to comment.