meld-cp / obsidian-encrypt

Hide secrets in your Obsidian.md vault
MIT License
585 stars 36 forks source link

Larger File is not able to be encrypted #41

Closed L00tz1ffer closed 1 year ago

L00tz1ffer commented 2 years ago

Got a File with 21k words. tryin to encrypt file but file does not get encrypted, is there a limit for purpose?!

meld-cp commented 1 year ago

Tracking down the issue to:

EncryptedFileContentView.ts:230 RangeError: Maximum call stack size exceeded
    at CryptoHelperV2.eval (CryptoHelper.ts:59:35)
    at Generator.next (<anonymous>)
    at fulfilled (tslib.es6.js:73:58)

which is this line

//convert array to base64
const base64Text = btoa( String.fromCharCode(...finalBytes) );

will work on a fix

meld-cp commented 1 year ago

I suspect the error is to do with the String.fromCharCode call.

To workaround the problem I'll need to batch the calls to String.fromCharCode and concatenate the results.