File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -723,6 +723,19 @@ export default class SyncManager {
723723 Object . keys ( treeFiles )
724724 . filter ( ( filePath : string ) => treeFiles [ filePath ] . content )
725725 . map ( async ( filePath : string ) => {
726+ // Some Markdown or JSON files might grow to be quite big, that makes it
727+ // impossible for the file-type library to guess their file type.
728+ // It also increases the amount of memory used by A LOT and might cause
729+ // issues in devices with low memory if there are lots of files to check.
730+ //
731+ // I don't fully trust file extensions as they're not completely reliable
732+ // to determine the file type, though I feel it's ok to compromise and rely
733+ // on them if it makes the plugin handle upload better on certain devices.
734+ if ( filePath . endsWith ( ".md" ) || filePath . endsWith ( ".json" ) ) {
735+ this . metadataStore . data . files [ filePath ] . sha =
736+ await this . calculateSHA ( filePath ) ;
737+ return ;
738+ }
726739 const buffer = await this . vault . adapter . readBinary ( filePath ) ;
727740 const fileType = await fileTypeFromBuffer ( buffer ) ;
728741 let newSha = "" ;
You can’t perform that action at this time.
0 commit comments