mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 22:49:53 +00:00
fix: check asset exists before transacting checksum
related to https://github.com/logseq/db-test/issues/415
This commit is contained in:
@@ -140,11 +140,13 @@
|
||||
repo (str asset-uuid) asset-type checksum url))]
|
||||
(when (:ex-data r)
|
||||
(throw (ex-info "upload asset failed" r)))
|
||||
(d/transact! conn
|
||||
[{:block/uuid asset-uuid
|
||||
:logseq.property.asset/remote-metadata {:checksum checksum :type asset-type}}]
|
||||
;; Don't generate rtc ops again, (block-ops & asset-ops)
|
||||
{:persist-op? false})
|
||||
;; asset might be deleted by the server before uploaded successfully
|
||||
(when (d/entity @conn [:block/uuid asset-uuid])
|
||||
(d/transact! conn
|
||||
[{:block/uuid asset-uuid
|
||||
:logseq.property.asset/remote-metadata {:checksum checksum :type asset-type}}]
|
||||
;; Don't generate rtc ops again, (block-ops & asset-ops)
|
||||
{:persist-op? false}))
|
||||
(client-op/remove-asset-op repo asset-uuid))))
|
||||
(c.m/concurrent-exec-flow 3 (m/seed asset-uuid->url))
|
||||
(m/reduce (constantly nil))))
|
||||
|
||||
Reference in New Issue
Block a user