Compare commits

...

3 Commits

Author SHA1 Message Date
Riccardo Ferretti
97f87692b6 v0.16.1 2021-11-30 19:22:01 +01:00
Riccardo Ferretti
4f76a6b24a Prepare for 0.16.1 2021-11-30 19:21:35 +01:00
Riccardo Ferretti
c822589733 fix for #851 - fixed listing resources by ID when files had same suffix 2021-11-30 19:20:23 +01:00
5 changed files with 20 additions and 6 deletions

View File

@@ -4,5 +4,5 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.16.0"
"version": "0.16.1"
}

View File

@@ -4,6 +4,12 @@ All notable changes to the "foam-vscode" extension will be documented in this fi
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [0.16.1] - 2021-11-30
Fixes and Improvements:
- Fixed diagnostic bug triggered when file had same suffix (#851)
## [0.16.0] - 2021-11-24
Features:

View File

@@ -8,7 +8,7 @@
"type": "git"
},
"homepage": "https://github.com/foambubble/foam",
"version": "0.16.0",
"version": "0.16.1",
"license": "MIT",
"publisher": "foam",
"engines": {

View File

@@ -71,6 +71,13 @@ describe('Workspace resources', () => {
ws.set(noteA);
expect(ws.list()).toEqual([noteA]);
});
it('#851 - listing by ID should not return files with same suffix', () => {
const ws = createTestWorkspace()
.set(createTestNote({ uri: 'test-file.md' }))
.set(createTestNote({ uri: 'file.md' }));
expect(ws.listById('file').length).toEqual(1);
});
});
describe('Graph', () => {

View File

@@ -82,13 +82,14 @@ export class FoamWorkspace implements IDisposable {
}
public listById(resourceId: string): Resource[] {
if (!hasExtension(resourceId)) {
resourceId = resourceId + '.md';
let needle = '/' + resourceId;
if (!hasExtension(needle)) {
needle = needle + '.md';
}
resourceId = normalize(resourceId);
needle = normalize(needle);
let resources = [];
for (const key of this.resources.keys()) {
if (key.endsWith(resourceId)) {
if (key.endsWith(needle)) {
resources.push(this.resources.get(normalize(key)));
}
}