Skip to content

fix/folder bru data loading issue in windows #2595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ export const collectionsSlice = createSlice({
}

if (isFolderRoot) {
const folderPath = path.dirname(file.meta.pathname);
const folderPath = getDirectoryName(file.meta.pathname);
const folderItem = findItemInCollectionByPathname(collection, folderPath);
if (folderItem) {
folderItem.root = file.data;
Expand Down
3 changes: 2 additions & 1 deletion packages/bruno-app/src/utils/collections/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import isEqual from 'lodash/isEqual';
import cloneDeep from 'lodash/cloneDeep';
import { uuid } from 'utils/common';
import path from 'path';
import slash from 'utils/common/slash';

const replaceTabsWithSpaces = (str, numSpaces = 2) => {
if (!str || !str.length || !isString(str)) {
Expand Down Expand Up @@ -98,7 +99,7 @@ export const findCollectionByItemUid = (collections, itemUid) => {
};

export const findItemByPathname = (items = [], pathname) => {
return find(items, (i) => i.pathname === pathname);
return find(items, (i) => slash(i.pathname) === slash(pathname));
};

export const findItemInCollectionByPathname = (collection, pathname) => {
Expand Down