mirror of
https://github.com/journeyman-cc/smeagol.git
synced 2026-04-12 18:05:06 +00:00
Merge branch 'fix_resource_handling' into develope
This commit is contained in:
commit
8aa6f27659
3 changed files with 23 additions and 9 deletions
|
|
@ -6,7 +6,12 @@
|
|||
[selmer.middleware :refer [wrap-error-page]]
|
||||
[prone.middleware :refer [wrap-exceptions]]
|
||||
[ring.middleware.anti-forgery :refer [wrap-anti-forgery]]
|
||||
[noir-exception.core :refer [wrap-internal-error]]))
|
||||
[ring.middleware.file :refer [wrap-file]]
|
||||
[ring.middleware.resource :refer [wrap-resource]]
|
||||
[ring.middleware.content-type :refer [wrap-content-type]]
|
||||
[ring.middleware.not-modified :refer [wrap-not-modified]]
|
||||
[noir-exception.core :refer [wrap-internal-error]]
|
||||
[smeagol.util :as util]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
|
|
@ -44,7 +49,12 @@
|
|||
|
||||
|
||||
(def production-middleware
|
||||
[#(wrap-internal-error % :log (fn [e] (timbre/error e)))])
|
||||
[#(wrap-internal-error % :log (fn [e] (timbre/error e)))
|
||||
#(wrap-file % util/content-dir
|
||||
{:index-files? false :prefer-handler? true})
|
||||
#(wrap-resource % "public")
|
||||
#(wrap-content-type %)
|
||||
#(wrap-not-modified %)])
|
||||
|
||||
|
||||
(defn load-middleware []
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"Process `source-text` and save it to the specified `file-path`, committing it
|
||||
to Git and finally redirecting to wiki-page."
|
||||
[params suffix request]
|
||||
(timbre/trace (format "process-source: '%s'" request))
|
||||
(let [source-text (:src params)
|
||||
page (:page params)
|
||||
file-name (str page suffix)
|
||||
|
|
@ -122,6 +123,7 @@
|
|||
(defn wiki-page
|
||||
"Render the markdown page specified in this `request`, if any. If none found, redirect to edit-page"
|
||||
[request]
|
||||
(timbre/trace (format "wiki-page: '%s'" request))
|
||||
(or
|
||||
(show-sanity-check-error)
|
||||
(let [params (keywordize-keys (:params request))
|
||||
|
|
@ -163,7 +165,7 @@
|
|||
"Render a form to allow the upload of a file."
|
||||
[request]
|
||||
(let [params (keywordize-keys (:params request))
|
||||
data-path (str (io/resource-path) "/content/uploads/")
|
||||
data-path (str util/content-dir "/content/uploads/")
|
||||
git-repo (hist/load-or-init-repo util/content-dir)
|
||||
upload (:upload params)
|
||||
uploaded (if upload (ul/store-upload params data-path))
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@
|
|||
filename (:filename upload)]
|
||||
(timbre/info
|
||||
(str "Storing upload file: " upload))
|
||||
(timbre/debug
|
||||
(str "store-upload mv file: " tmp-file " to: " path filename))
|
||||
(if tmp-file
|
||||
(do
|
||||
(.renameTo tmp-file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue