bugfix of the wrong url encoding with non-ascii symbols

This commit is contained in:
Christian Mueller
2012-06-13 20:24:59 +02:00
parent 6e8a27f50f
commit c3a4b5fe2d
2 changed files with 14 additions and 15 deletions
+11 -12
View File
@@ -3,6 +3,7 @@
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/clojure-contrib "1.2.0"]
[hiccup "1.0.0"]
[ring/ring-core "1.1.0"]
[cssgen "0.2.6"]
[jayq "0.1.0-alpha2"]
[fetch "0.1.0-alpha2"]
@@ -10,17 +11,15 @@
[org.pegdown/pegdown "1.1.0"]
[noir "1.3.0-beta1"]]
:plugins [[lein-cljsbuild "0.1.10"]]
:cljsbuild {
:builds [{
; The path to the top-level ClojureScript source directory:
:source-path "src-cljs"
; The standard ClojureScript compiler options:
; (See the ClojureScript compiler documentation for details.)
:crossovers [NoteHub.crossover]
:compiler {
:output-dir "resources/public/cljs/"
:output-to "resources/public/cljs/main.js" ; default: main.js in current directory
:optimizations :whitespace
:pretty-print true}}]}
:jvm-opts ["-Dfile.encoding=utf-8"]
:cljsbuild
{:crossovers [NoteHub.crossover],
:builds
[{:source-path "src-cljs",
:compiler
{:output-dir "resources/public/cljs/",
:output-to "resources/public/cljs/main.js",
:optimizations :whitespace,
:pretty-print true}}]}
:main NoteHub.server)
+3 -3
View File
@@ -8,6 +8,7 @@
[clojure.string :rename {replace sreplace} :only [split replace lower-case]]
[clojure.core.incubator :only [-?>]]
[hiccup.form]
[ring.util.codec :only [url-encode]]
[hiccup.core]
[hiccup.util :only [escape-html]]
[noir.session :only [flash-put! flash-get]]
@@ -52,7 +53,7 @@
; Routes
; ======
; This function answers to an AJAX request: it gets a sesion key and a markdown text.
; This function answers to an AJAX request: it gets a session key and a markdown text.
; It returns the html code of the provided markdown and a new session key.
(defremote get-preview-md [session-key md]
(when (flash-get session-key)
@@ -151,6 +152,5 @@
(map #(str proposed-title "-" (+ 2 %)) (range)))))]
(do
(set-note date title draft)
; TODO: the redirect is broken if title contains UTF chars
(redirect (url year month day title))))
(redirect (url year month day (url-encode title)))))
(response 400))))