mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: crash when extracting attachments from notes
This commit is contained in:
@@ -153,7 +153,7 @@ export default class Sync {
|
||||
|
||||
async _uploadAttachments(token) {
|
||||
const attachments = this._db.attachments.pending;
|
||||
console.log("Uploading attachments", attachments);
|
||||
console.log("Uploading attachments", this._db.attachments.pending);
|
||||
for (let attachment of attachments) {
|
||||
const { hash } = attachment.metadata;
|
||||
const url = await this._getPresignedURL(hash, token, "PUT");
|
||||
|
||||
@@ -122,7 +122,11 @@ export default class Attachments extends Collection {
|
||||
|
||||
async save(data, type) {
|
||||
await this._initEncryptionKey();
|
||||
await this._db.fs.writeEncrypted(null, { data, type, key: this.key });
|
||||
return await this._db.fs.writeEncrypted(null, {
|
||||
data,
|
||||
type,
|
||||
key: this.key,
|
||||
});
|
||||
}
|
||||
|
||||
get pending() {
|
||||
|
||||
@@ -106,7 +106,7 @@ class Tiny {
|
||||
const type =
|
||||
getDatasetAttribute(attachment, "mime") || mime || "image/jpeg";
|
||||
const metadata = await store(data, "base64");
|
||||
setDatasetAttribute("hash", metadata.hash);
|
||||
setDatasetAttribute(attachment, "hash", metadata.hash);
|
||||
|
||||
attachments.push({
|
||||
type,
|
||||
|
||||
Reference in New Issue
Block a user