Skip to content

Commit

Permalink
fix/folder bru data loading issue in windows (usebruno#2595)
Browse files Browse the repository at this point in the history
* pr review changes

* collection root object in export json

* import environment updates

* validations for folder.bru paths for windows
  • Loading branch information
lohxt1 authored and jwetzell committed Aug 2, 2024
1 parent aca13be commit e1de188
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit e1de188

Please sign in to comment.