Fixed relative paths for file params in Windows (#1564)

This commit is contained in:
Mateo Gallardo 2024-02-13 19:08:57 -03:00 committed by GitHub
parent f8eac3469f
commit 485b2f48bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ import { useDispatch } from 'react-redux';
import { browseFiles } from 'providers/ReduxStore/slices/collections/actions';
import { IconX } from '@tabler/icons';
import { isWindowsOS } from 'utils/common/platform';
import slash from 'utils/common/slash';
const FilePickerEditor = ({ value, onChange, collection }) => {
value = value || [];
@ -27,7 +28,7 @@ const FilePickerEditor = ({ value, onChange, collection }) => {
const collectionDir = collection.pathname;
if (filePath.startsWith(collectionDir)) {
return path.relative(collectionDir, filePath);
return path.relative(slash(collectionDir), slash(filePath));
}
return filePath;