husjon / obsidian-file-cleaner-redux

A plugin for Obsidian to help clean up files in your vault
MIT License
29 stars 2 forks source link

Added check for canvas files when wildcard (`.*`) or `.canvas` extension is used #48

Closed husjon closed 6 months ago

husjon commented 6 months ago

When using wildcard extensions (.*) or .canvas in the Attachment extensions option, canvas files where not properly checked for size.

This PR checks for the canvas files size to determine if any nodes are added.

Comment from filter:

// Newly created or cleared out canvas files are currently 28bytes or less
// A single node adds at a minumum about 80 bytes,
//   hence any canvas file less than 50 bytes are tagged as candidates for cleanup

Canvas file structure:

New:

{}

Empty (after deleting nodes):

{
    "nodes":[],
    "edges":[]
}

(minified, this is 24 bytes)

Fixes #46