mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-07 17:32:58 +02:00
#595: Fix media metadata
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
- [#572](https://github.com/estruyf/vscode-front-matter/issues/572): Fix the media snippet placeholder link
|
||||
- [#577](https://github.com/estruyf/vscode-front-matter/issues/577): Fix in the `dataFile` field where data entries get overwritten
|
||||
- [#590](https://github.com/estruyf/vscode-front-matter/issues/590): Fix for image fields inside a sub-block
|
||||
- [#595](https://github.com/estruyf/vscode-front-matter/issues/595): Fix for media metadata now showing up
|
||||
|
||||
## [8.4.0] - 2023-04-03 - [Release notes](https://beta.frontmatter.codes/updates/v8.4.0)
|
||||
|
||||
|
||||
+17
-15
@@ -147,22 +147,24 @@ export class MediaHelpers {
|
||||
const total = files.length;
|
||||
|
||||
// Get media set
|
||||
files = files.map((file) => {
|
||||
try {
|
||||
const metadata = MediaLibrary.getInstance().get(file.fsPath);
|
||||
const mimeType = lookup(file.fsPath);
|
||||
files = await Promise.all(
|
||||
files.map(async (file) => {
|
||||
try {
|
||||
const metadata = await MediaLibrary.getInstance().get(file.fsPath);
|
||||
const mimeType = lookup(file.fsPath);
|
||||
|
||||
return {
|
||||
...file,
|
||||
dimensions:
|
||||
mimeType && mimeType.startsWith('image/') ? imageSize(file.fsPath) : undefined,
|
||||
mimeType: lookup(file.fsPath) || '',
|
||||
...metadata
|
||||
};
|
||||
} catch (e) {
|
||||
return { ...file };
|
||||
}
|
||||
});
|
||||
return {
|
||||
...file,
|
||||
dimensions:
|
||||
mimeType && mimeType.startsWith('image/') ? imageSize(file.fsPath) : undefined,
|
||||
mimeType: lookup(file.fsPath) || '',
|
||||
...metadata
|
||||
};
|
||||
} catch (e) {
|
||||
return { ...file };
|
||||
}
|
||||
})
|
||||
);
|
||||
files = files.filter((f) => f.mtime !== undefined);
|
||||
|
||||
// Sort the files
|
||||
|
||||
Reference in New Issue
Block a user