[GH-ISSUE #1509] Show folder path instead of folder name when saving a request #481

Closed
opened 2026-03-16 15:36:32 +03:00 by kerem · 1 comment
Owner

Originally created by @rohanrajpal on GitHub (Feb 23, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1509

Originally assigned to: @rohanrajpal on GitHub.

Describe the bug
If two folders have the same name, then the user is confused about which folder belongs where
To Reproduce
Steps to reproduce the behavior:

  1. Go to hoppscotch.io
  2. Create two folders with the same name in collections tab
  3. Click on save request as
  4. Scroll down to 'folder'
  5. See error

Expected behavior
A clear and concise description of what you expected to happen.
A path should be displayed instead of only the folder name.
Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional context
I've solved the problem by modifying the code as follows

diff --git a/components/collections/save-request-as.vue b/components/collections/save-request-as.vue
index 3f9a9ee..9865916 100644
--- a/components/collections/save-request-as.vue
+++ b/components/collections/save-request-as.vue
@@ -187,12 +187,12 @@ export default {
   },
 }
 
-function getFolderNames(folders, namesList) {
+function getFolderNames(folders, namesList, folderName="") {
   if (folders.length) {
     folders.forEach((folder) => {
-      namesList.push(folder.name)
+      namesList.push(folderName+folder.name)
       if (folder.folders && folder.folders.length) {
-        getFolderNames(folder.folders, namesList)
+        getFolderNames(folder.folders, namesList, folder.name+"/")
       }
     })
   }

Now the view looks like
image

Would be happy to make a PR if I'm assigned this issue

Originally created by @rohanrajpal on GitHub (Feb 23, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1509 Originally assigned to: @rohanrajpal on GitHub. **Describe the bug** If two folders have the same name, then the user is confused about which folder belongs where **To Reproduce** Steps to reproduce the behavior: 1. Go to hoppscotch.io 2. Create two folders with the same name in collections tab 2. Click on `save request as` 3. Scroll down to 'folder' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. A path should be displayed instead of only the folder name. **Screenshots** If applicable, add screenshots to help explain your problem. ![image](https://user-images.githubusercontent.com/7023147/108854853-5570af00-760e-11eb-8fc7-d1a77021a68a.png) **Additional context** I've solved the problem by modifying the code as follows ```diff diff --git a/components/collections/save-request-as.vue b/components/collections/save-request-as.vue index 3f9a9ee..9865916 100644 --- a/components/collections/save-request-as.vue +++ b/components/collections/save-request-as.vue @@ -187,12 +187,12 @@ export default { }, } -function getFolderNames(folders, namesList) { +function getFolderNames(folders, namesList, folderName="") { if (folders.length) { folders.forEach((folder) => { - namesList.push(folder.name) + namesList.push(folderName+folder.name) if (folder.folders && folder.folders.length) { - getFolderNames(folder.folders, namesList) + getFolderNames(folder.folders, namesList, folder.name+"/") } }) } ``` Now the view looks like ![image](https://user-images.githubusercontent.com/7023147/108861415-332e5f80-7615-11eb-8ae7-2f4e5df69b38.png) Would be happy to make a PR if I'm assigned this issue
kerem closed this issue 2026-03-16 15:36:38 +03:00
Author
Owner

@liyasthomas commented on GitHub (Feb 23, 2021):

This looks handy 👍
Assigning this to you.

<!-- gh-comment-id:784267055 --> @liyasthomas commented on GitHub (Feb 23, 2021): This looks handy 👍 Assigning this to you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#481
No description provided.