A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: handle same filename
ammarahm-edb5c8afe8f7f0
diff --git a/apps/mobile/app/services/exporter.js b/apps/mobile/app/services/exporter.jsindex 81061c4dd..b5b520f71 100644--- a/apps/mobile/app/services/exporter.js+++ b/apps/mobile/app/services/exporter.js@@ -85,7 +85,7 @@ async function save(path, data, fileName, extension) {uri = await ScopedStorage.writeFile(path,data,- fileName + `.${extension}`,+ `${fileName}_${Date.now()}_.${extension}`,MIMETypes[extension],extension === "pdf" ? "base64" : "utf8",false@@ -197,6 +197,19 @@ function zipsync(results) {return Buffer.from(data.buffer).toString("base64");}+function getUniqueFileName(fileName, results) {+ const chunks = fileName.split(".");+ const ext = chunks.pop();+ const name = chunks.join(".");+ let resolvedName = fileName;+ let count = 0;+ while (results[resolvedName]) {+ resolvedName = `${name}${++count}.${ext}`;+ }++ return resolvedName;+}+/**** @param {"txt" | "pdf" | "md" | "html"} type@@ -216,10 +229,8 @@ async function bulkExport(notes, type, callback) {replacement: "_"});if (result) {- results[fileName + `.${type}`] = Buffer.from(- result,- type === "pdf" ? "base64" : "utf-8"- );+ results[getUniqueFileName(fileName + `.${type}`, results)] =+ Buffer.from(result, type === "pdf" ? "base64" : "utf-8");}callback(`${i + 1}/${notes.length}`);} catch (e) {diff --git a/apps/mobile/app/stores/use-user-store.ts b/apps/mobile/app/stores/use-user-store.tsindex c082a856d..2176918d4 100644--- a/apps/mobile/app/stores/use-user-store.ts+++ b/apps/mobile/app/stores/use-user-store.ts@@ -48,7 +48,6 @@ export const useUserStore = create<UserStore>((set) => ({setUser: (user) => set({ user: user }),setPremium: (premium) => set({ premium: premium }),setSyncing: (syncing, status = SyncStatus.Passed) => {- console.log("set syncing", syncing, status);set({ syncing: syncing, lastSyncStatus: status });},setLastSynced: (lastSynced) => set({ lastSynced: lastSynced }),diff --git a/apps/mobile/app/utils/sanitizer/index.js b/apps/mobile/app/utils/sanitizer/index.jsindex ca914899f..02836238f 100644--- a/apps/mobile/app/utils/sanitizer/index.js+++ b/apps/mobile/app/utils/sanitizer/index.js@@ -51,7 +51,7 @@ var illegalRe = /[/?<>\\:*|"]/g;var reservedRe = /^\.+$/;var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var windowsTrailingRe = /[. ]+$/;-var whitespace = /\W+/g;+var whitespace = /\s+/g;function sanitize(input, replacement) {if (typeof input !== "string") {