fix: image paste not work on production

pull/10981/head
Tienson Qin 2024-08-08 13:55:08 +08:00
parent 9b8a8e7da5
commit beaa1709bb
2 changed files with 2 additions and 3 deletions

View File

@ -191,7 +191,8 @@
(defn path->file-ext (defn path->file-ext
[path-or-file-name] [path-or-file-name]
(second (re-find #"(?:\.)(\w+)[^.]*$" path-or-file-name))) (let [last-part (last (string/split path-or-file-name #"/"))]
(second (re-find #"(?:\.)(\w+)[^.]*$" last-part))))
(defn get-format (defn get-format
"File path to format keyword, :org, :markdown, etc." "File path to format keyword, :org, :markdown, etc."

View File

@ -396,10 +396,8 @@
(p/then (assets-handler/make-asset-url href) #(reset! src %))) (p/then (assets-handler/make-asset-url href) #(reset! src %)))
(when @src (when @src
;; NOTE(andelf): Under nfs context, src might be a bare blob:http://..../uuid URI without ext info
(let [ext (keyword (or (util/get-file-ext @src) (let [ext (keyword (or (util/get-file-ext @src)
(util/get-file-ext href))) (util/get-file-ext href)))
_ (prn :debug :ext ext :href href :src @src)
repo (state/get-current-repo) repo (state/get-current-repo)
repo-dir (config/get-repo-dir repo) repo-dir (config/get-repo-dir repo)
path (str repo-dir href) path (str repo-dir href)