mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 02:16:30 +00:00
fix(pdf): incorrect file name for the browser
This commit is contained in:
@@ -41,13 +41,16 @@
|
||||
(defn inflate-asset
|
||||
[original-path & {:keys [href]}]
|
||||
(let [web-link? (string/starts-with? original-path "http")
|
||||
blob-res? (some-> href (string/starts-with? "blob"))
|
||||
filename (util/node-path.basename original-path)
|
||||
ext-name (util/get-file-ext filename)
|
||||
url (if (some-> href (string/starts-with? "blob")) href
|
||||
url (if blob-res? href
|
||||
(assets-handler/normalize-asset-resource-url original-path))
|
||||
filename' (if web-link? filename (get-in-repo-assets-full-filename url))
|
||||
filename' (some-> filename' (js/decodeURIComponent) (string/replace ' "/" "_"))
|
||||
filekey (util/safe-sanitize-file-name (subs filename' 0 (- (count filename') (inc (count ext-name)))))]
|
||||
filename' (if (or web-link? blob-res?) filename
|
||||
(some-> (get-in-repo-assets-full-filename url)
|
||||
(js/decodeURIComponent) (string/replace ' "/" "_")))
|
||||
filekey (util/safe-sanitize-file-name
|
||||
(subs filename' 0 (- (count filename') (inc (count ext-name)))))]
|
||||
(when-let [key (and (not (string/blank? filekey))
|
||||
(if web-link?
|
||||
(str filekey "__" (hash url))
|
||||
|
||||
Reference in New Issue
Block a user