Browse Source

bugfix of the wrong url encoding with non-ascii symbols

master
Christian Mueller 14 years ago
parent
commit
c3a4b5fe2d
  1. 23
      project.clj
  2. 6
      src/NoteHub/views/pages.clj

23
project.clj

@ -3,6 +3,7 @@
:dependencies [[org.clojure/clojure "1.4.0"] :dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/clojure-contrib "1.2.0"] [org.clojure/clojure-contrib "1.2.0"]
[hiccup "1.0.0"] [hiccup "1.0.0"]
[ring/ring-core "1.1.0"]
[cssgen "0.2.6"] [cssgen "0.2.6"]
[jayq "0.1.0-alpha2"] [jayq "0.1.0-alpha2"]
[fetch "0.1.0-alpha2"] [fetch "0.1.0-alpha2"]
@ -10,17 +11,15 @@
[org.pegdown/pegdown "1.1.0"] [org.pegdown/pegdown "1.1.0"]
[noir "1.3.0-beta1"]] [noir "1.3.0-beta1"]]
:plugins [[lein-cljsbuild "0.1.10"]] :plugins [[lein-cljsbuild "0.1.10"]]
:cljsbuild { :jvm-opts ["-Dfile.encoding=utf-8"]
:builds [{ :cljsbuild
; The path to the top-level ClojureScript source directory: {:crossovers [NoteHub.crossover],
:source-path "src-cljs" :builds
; The standard ClojureScript compiler options: [{:source-path "src-cljs",
; (See the ClojureScript compiler documentation for details.) :compiler
:crossovers [NoteHub.crossover] {:output-dir "resources/public/cljs/",
:compiler { :output-to "resources/public/cljs/main.js",
:output-dir "resources/public/cljs/" :optimizations :whitespace,
:output-to "resources/public/cljs/main.js" ; default: main.js in current directory :pretty-print true}}]}
:optimizations :whitespace
:pretty-print true}}]}
:main NoteHub.server) :main NoteHub.server)

6
src/NoteHub/views/pages.clj

@ -8,6 +8,7 @@
[clojure.string :rename {replace sreplace} :only [split replace lower-case]] [clojure.string :rename {replace sreplace} :only [split replace lower-case]]
[clojure.core.incubator :only [-?>]] [clojure.core.incubator :only [-?>]]
[hiccup.form] [hiccup.form]
[ring.util.codec :only [url-encode]]
[hiccup.core] [hiccup.core]
[hiccup.util :only [escape-html]] [hiccup.util :only [escape-html]]
[noir.session :only [flash-put! flash-get]] [noir.session :only [flash-put! flash-get]]
@ -52,7 +53,7 @@
; Routes ; 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. ; It returns the html code of the provided markdown and a new session key.
(defremote get-preview-md [session-key md] (defremote get-preview-md [session-key md]
(when (flash-get session-key) (when (flash-get session-key)
@ -151,6 +152,5 @@
(map #(str proposed-title "-" (+ 2 %)) (range)))))] (map #(str proposed-title "-" (+ 2 %)) (range)))))]
(do (do
(set-note date title draft) (set-note date title draft)
; TODO: the redirect is broken if title contains UTF chars (redirect (url year month day (url-encode title)))))
(redirect (url year month day title))))
(response 400)))) (response 400))))

Loading…
Cancel
Save