Skip to content
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

Bugfix/request disappearing #1181

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# dependencies
node_modules
yarn.lock
bun.lockb
pnpm-lock.yaml
.pnp
.pnp.js
Expand Down
Binary file added bun.lockb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ const Collection = ({ collection, searchText }) => {

const requestItems = sortRequestItems(filter(collection.items, (i) => isItemARequest(i)));
const folderItems = sortFolderItems(filter(collection.items, (i) => isItemAFolder(i)));

return (
<StyledWrapper className="flex flex-col">
{showNewRequestModal && <NewRequest collection={collection} onClose={() => setShowNewRequestModal(false)} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const Collections = () => {
const [searchText, setSearchText] = useState('');
const { collections } = useSelector((state) => state.collections);
const [createCollectionModalOpen, setCreateCollectionModalOpen] = useState(false);

if (!collections || !collections.length) {
return (
<StyledWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ export const collectionsSlice = createSlice({
},
collectionClicked: (state, action) => {
const collection = findCollectionByUid(state.collections, action.payload);

if (collection) {
collection.collapsed = !collection.collapsed;
}
Expand All @@ -334,7 +333,6 @@ export const collectionsSlice = createSlice({

if (collection) {
const item = findItemInCollection(collection, action.payload.itemUid);

if (item && item.type === 'folder') {
item.collapsed = !item.collapsed;
}
Expand Down
1 change: 0 additions & 1 deletion packages/bruno-app/src/utils/collections/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export const findItemInCollectionByPathname = (collection, pathname) => {

export const findItemInCollection = (collection, itemUid) => {
let flattenedItems = flattenItems(collection.items);

return findItem(flattenedItems, itemUid);
};

Expand Down
2 changes: 0 additions & 2 deletions packages/bruno-electron/src/app/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,7 @@ const add = async (win, pathname, collectionUid, collectionPath) => {

try {
let bruContent = fs.readFileSync(pathname, 'utf8');

file.data = bruToJson(bruContent);

hydrateRequestWithUuid(file.data, pathname);
win.webContents.send('main:collection-tree-updated', 'addFile', file);
} catch (err) {
Expand Down
1 change: 0 additions & 1 deletion packages/bruno-electron/src/bru/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const envJsonToBru = (json) => {
const bruToJson = (bru) => {
try {
const json = bruToJsonV2(bru);

let requestType = _.get(json, 'meta.type');
if (requestType === 'http') {
requestType = 'http-request';
Expand Down
2 changes: 1 addition & 1 deletion packages/bruno-lang/v2/src/bruToJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const mapPairListToKeyValPairs = (pairList = [], parseEnabled = true) => {
}
return _.map(pairList[0], (pair) => {
let name = _.keys(pair)[0];
let value = decodeURIComponent(pair[name]);
let value = name === 'password' ? pair[name] : decodeURIComponent(pair[name]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpoulaindev We need to solve this in a generic way and should not hardcode this to apply to any key-val pair that has the name password

The mapPairListToKeyValPairs is used to parse all key val pairs (headers, assertions, vars, query params)

Copy link
Contributor Author

@bpoulaindev bpoulaindev Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@helloanoop how could you have a generic function that work both on a password (which can be of any form), a random string and an encoded URL with params ?
Edit : we could encode everything in base 64 but i'm afraid it would hurt performance


if (!parseEnabled) {
return {
Expand Down