Skip to content

Commit

Permalink
fix: test backend media file fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
KaneFreeman committed Apr 26, 2024
1 parent eeb60a7 commit e655745
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/backends/test/implementation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import attempt from 'lodash/attempt';
import isError from 'lodash/isError';
import take from 'lodash/take';
import trim from 'lodash/trim';
import unset from 'lodash/unset';
import { basename, dirname } from 'path';
import { v4 as uuid } from 'uuid';
Expand All @@ -15,7 +16,6 @@ import { isNotEmpty } from '@staticcms/core/lib/util/string.util';
import AssetProxy from '@staticcms/core/valueObjects/AssetProxy';
import AuthenticationPage from './AuthenticationPage';

import type { WorkflowStatus } from '@staticcms/core/constants/publishModes';
import type {
BackendClass,
BackendEntry,
Expand All @@ -29,6 +29,7 @@ import type {
UnpublishedEntry,
User,
} from '@staticcms/core';
import type { WorkflowStatus } from '@staticcms/core/constants/publishModes';

type RepoFile = { path: string; content: string | AssetProxy; isDirectory?: boolean };
type RepoTree = { [key: string]: RepoFile | RepoTree };
Expand Down Expand Up @@ -289,14 +290,14 @@ export default class TestBackend implements BackendClass {
}
const files = getFolderFiles(
window.repoFiles,
mediaFolder.split('/')[0],
trim(mediaFolder, '/').split('/')[0],
'',
100,
undefined,
undefined,
folderSupport,
).filter(f => {
return dirname(f.path) === mediaFolder;
return dirname(f.path) === trim(mediaFolder, '/');
});

return files.map(f => ({
Expand Down

0 comments on commit e655745

Please sign in to comment.