Skip to content

Commit 1878311

Browse files
Fixed canvas metadata cache compution not adding to uniqueFileLookup map - encapsulation error
1 parent a563a6a commit 1878311

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/@types/Obsidian.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ declare module "obsidian" {
9292
fileCache: FileCache
9393
metadataCache: MetadataCacheMap
9494
resolvedLinks: ResolvedLinks
95+
uniqueFileLookup: {
96+
get: (name: string) => TFile[]
97+
add: (name: string, file: TFile) => void
98+
}
9599

96100
computeMetadataAsync: (buffer: ArrayBuffer) => Promise<ExtendedCachedMetadata>
97101

src/patchers/metadata-cache-patcher.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export default class MetadataCachePatcher extends Patcher {
2727
if (FilepathHelper.extension(file.path) !== 'canvas')
2828
return next.call(this, file, ...args)
2929

30+
// Add file to uniqueFileLookup
31+
this.uniqueFileLookup.add(file.name.toLowerCase(), file)
32+
3033
// Update the cache
3134
const fileHash = await HashHelper.getFileHash(that.plugin, file)
3235
this.saveFileCache(file.path, {

0 commit comments

Comments
 (0)