File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 208
208
209
209
(defn ->file-or-ns [nav-path]
210
210
(cond (str/starts-with? nav-path " '" ) (symbol (subs nav-path 1 ))
211
- :else nav-path))
211
+ ( re-find #" \. (cljc?|md)$" nav-path) nav-path))
212
212
213
213
(defn show! [opts file-or-ns]
214
214
((resolve 'nextjournal.clerk/show!) opts file-or-ns))
229
229
:headers {" Location" (or (:nav-path @!doc)
230
230
(->nav-path 'nextjournal.clerk.home))}}
231
231
:else
232
- (do
233
- (try (show! {:skip-history? true } (->file-or-ns nav-path))
234
- (catch Exception _))
235
- {:status 200
236
- :headers {" Content-Type" " text/html" " Cache-Control" " no-store" }
237
- :body (view/->html {:doc (view/doc->viewer @!doc)
238
- :resource->url @config/!resource->url
239
- :conn-ws? true })}))))
232
+ (if-let [file-or-ns (->file-or-ns nav-path)]
233
+ (do (try (show! {:skip-history? true } file-or-ns)
234
+ (catch Exception _))
235
+ {:status 200
236
+ :headers {" Content-Type" " text/html" " Cache-Control" " no-store" }
237
+ :body (view/->html {:doc (view/doc->viewer @!doc)
238
+ :resource->url @config/!resource->url
239
+ :conn-ws? true })})
240
+ {:status 404
241
+ :headers {" Content-Type" " text/plain" }
242
+ :body (format " Could not find notebook at %s." (pr-str nav-path))}))))
240
243
241
244
(defn app [{:as req :keys [uri]}]
242
245
(if (:websocket? req)
You can’t perform that action at this time.
0 commit comments