Skip to content

Commit

Permalink
Bugfix: looking in the wrong directory for uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-brooke committed Feb 14, 2020
1 parent 0417fda commit c06fce3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion resources/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
</div>
</div>
<h1>{% i18n site-title %}: {{title}}</h1>
{{header|safe}}
<div id="header">
{{header|safe}}
</div>
{% if message %}
<div id="message">
<p class="message">{{message}}</p>
Expand Down
14 changes: 11 additions & 3 deletions src/smeagol/routes/wiki.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[noir.util.route :as route]
[noir.session :as session]
[smeagol.authenticate :as auth]
[smeagol.configuration :refer [config]]
[smeagol.diff2html :as d2h]
[smeagol.formatting :refer [md->html]]
[smeagol.history :as hist]
Expand Down Expand Up @@ -187,7 +188,6 @@
[request]
(let
[params (keywordize-keys (:params request))
data-path (str util/content-dir "/uploads/")
cl (count (io/resource-path))
files
(map
Expand All @@ -202,11 +202,19 @@
(fs/mod-time %)
(format-instant (fs/mod-time %)))
(fs/name %)
(subs (str (fs/absolute %)) cl)])
(try
(subs (str (fs/absolute %)) cl)
(catch StringIndexOutOfBoundsException x
(log/error "Could not resolve relative path for" %
";\n resource-path is:" (io/resource-path)
";\n absolute path is:" (fs/absolute %)
";\n data-path is:" util/upload-dir
";\n content path is:" (:content-dir config))
%))])
(remove
#(or (cs/starts-with? (fs/name %) ".")
(fs/directory? %))
(file-seq (clojure.java.io/file data-path))))]
(file-seq (clojure.java.io/file util/upload-dir))))]
(log/info (with-out-str (pprint files)))
(layout/render
"list-uploads.html"
Expand Down

0 comments on commit c06fce3

Please sign in to comment.