Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit e655745

Browse files
committed
fix: test backend media file fetch
1 parent eeb60a7 commit e655745

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/core/src/backends/test/implementation.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import attempt from 'lodash/attempt';
22
import isError from 'lodash/isError';
33
import take from 'lodash/take';
4+
import trim from 'lodash/trim';
45
import unset from 'lodash/unset';
56
import { basename, dirname } from 'path';
67
import { v4 as uuid } from 'uuid';
@@ -15,7 +16,6 @@ import { isNotEmpty } from '@staticcms/core/lib/util/string.util';
1516
import AssetProxy from '@staticcms/core/valueObjects/AssetProxy';
1617
import AuthenticationPage from './AuthenticationPage';
1718

18-
import type { WorkflowStatus } from '@staticcms/core/constants/publishModes';
1919
import type {
2020
BackendClass,
2121
BackendEntry,
@@ -29,6 +29,7 @@ import type {
2929
UnpublishedEntry,
3030
User,
3131
} from '@staticcms/core';
32+
import type { WorkflowStatus } from '@staticcms/core/constants/publishModes';
3233

3334
type RepoFile = { path: string; content: string | AssetProxy; isDirectory?: boolean };
3435
type RepoTree = { [key: string]: RepoFile | RepoTree };
@@ -289,14 +290,14 @@ export default class TestBackend implements BackendClass {
289290
}
290291
const files = getFolderFiles(
291292
window.repoFiles,
292-
mediaFolder.split('/')[0],
293+
trim(mediaFolder, '/').split('/')[0],
293294
'',
294295
100,
295296
undefined,
296297
undefined,
297298
folderSupport,
298299
).filter(f => {
299-
return dirname(f.path) === mediaFolder;
300+
return dirname(f.path) === trim(mediaFolder, '/');
300301
});
301302

302303
return files.map(f => ({

0 commit comments

Comments
 (0)