|
@@ -1188,7 +1188,7 @@
|
|
|
(:block/uuid asset-data)
|
|
|
{:asset-name-uuid [asset-name (:block/uuid asset-data)]}
|
|
|
|
|
|
- (nil? (get-asset-block-id assets asset-name))
|
|
|
+ (not (get-asset-block-id assets asset-name))
|
|
|
(js/console.error (str "No asset-id for " asset-name))
|
|
|
|
|
|
:else
|
|
@@ -1964,13 +1964,14 @@
|
|
|
|
|
|
(defn- read-and-copy-asset-files
|
|
|
"Reads and copies files under assets/"
|
|
|
- [*asset-files <read-and-copy-asset-file {:keys [notify-user set-ui-state assets]
|
|
|
+ [*asset-files <read-and-copy-asset-file {:keys [notify-user set-ui-state assets rpath-key]
|
|
|
:or {set-ui-state (constantly nil)}}]
|
|
|
(assert <read-and-copy-asset-file "read-and-copy-asset-file fn required")
|
|
|
- (let [asset-files (mapv #(assoc %1 :idx %2)
|
|
|
- ;; Sort files to ensure reproducible import behavior
|
|
|
- (sort-by :path *asset-files)
|
|
|
- (range 0 (count *asset-files)))
|
|
|
+ (let [asset-files (let [assets (common-util/distinct-by rpath-key *asset-files)]
|
|
|
+ (mapv #(assoc %1 :idx %2)
|
|
|
+ ;; Sort files to ensure reproducible import behavior
|
|
|
+ (sort-by :path assets)
|
|
|
+ (range 0 (count assets))))
|
|
|
read-and-copy-asset (fn read-and-copy-asset [{:keys [path] :as file}]
|
|
|
(-> (<read-and-copy-asset-file
|
|
|
file assets
|
|
@@ -1980,7 +1981,7 @@
|
|
|
pdf-annotation? (some #{:highlights} (keys edn-content))
|
|
|
with-edn-content (fn [m]
|
|
|
(cond-> m
|
|
|
- edn?
|
|
|
+ edn-content
|
|
|
(assoc :edn-content edn-content)))]
|
|
|
{:with-edn-content with-edn-content
|
|
|
:pdf-annotation? pdf-annotation?})))
|
|
@@ -2100,7 +2101,7 @@
|
|
|
;; Assets are read first as doc-files need data from them to make Asset blocks.
|
|
|
(read-and-copy-asset-files asset-files
|
|
|
<read-and-copy-asset
|
|
|
- (merge (select-keys options [:notify-user :set-ui-state])
|
|
|
+ (merge (select-keys options [:notify-user :set-ui-state :rpath-key])
|
|
|
{:assets (get-in doc-options [:import-state :assets])}))
|
|
|
(export-doc-files conn doc-files <read-file doc-options)
|
|
|
(export-favorites-from-config-edn conn repo-or-conn config {})
|