mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
mobile: fix note with attachments not saved from share extension
This commit is contained in:
@@ -16,7 +16,6 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import "@azure/core-asynciterator-polyfill";
|
||||
import "react-native-gesture-handler";
|
||||
import {
|
||||
THEME_COMPATIBILITY_VERSION,
|
||||
@@ -24,7 +23,6 @@ import {
|
||||
} from "@notesnook/theme";
|
||||
import React, { useEffect } from "react";
|
||||
import { I18nManager, View } from "react-native";
|
||||
import "react-native-gesture-handler";
|
||||
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||
import AppLockedOverlay from "./components/app-lock-overlay";
|
||||
|
||||
@@ -33,7 +33,7 @@ const santizeUri = (uri) => {
|
||||
|
||||
export async function attachFile(uri, hash, type, filename, options) {
|
||||
try {
|
||||
let exists = db.attachments.exists(hash);
|
||||
let exists = await db.attachments.exists(hash);
|
||||
let encryptionInfo;
|
||||
if (options?.hash && options.hash !== hash) return false;
|
||||
|
||||
@@ -50,6 +50,7 @@ export async function attachFile(uri, hash, type, filename, options) {
|
||||
encryptionInfo.alg = "xcha-stream";
|
||||
encryptionInfo.size = encryptionInfo.length;
|
||||
encryptionInfo.key = key;
|
||||
console.log(encryptionInfo);
|
||||
if (options?.reupload && exists) await db.attachments.reset(hash);
|
||||
} else {
|
||||
encryptionInfo = { hash: hash };
|
||||
@@ -126,9 +127,8 @@ async function createNotes(bundle) {
|
||||
} else {
|
||||
content = `<p><span data-hash="${hash}" data-mime="${file.type}" data-filename="${file.name}" data-size="${file.size}" /></p>`;
|
||||
}
|
||||
const rawContent = await db.content.raw(
|
||||
db.notes.note(id).data?.contentId
|
||||
);
|
||||
const note = await db.notes.note(id);
|
||||
const rawContent = await db.content.get(note?.contentId);
|
||||
await db.notes.add({
|
||||
id: id,
|
||||
content: {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
import "@azure/core-asynciterator-polyfill";
|
||||
import 'react-native-url-polyfill/auto';
|
||||
import "./polyfills/console-time.js"
|
||||
global.Buffer = require('buffer').Buffer;
|
||||
|
||||
Reference in New Issue
Block a user