diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js index 66c0fcd62..6dbb69064 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js @@ -20,7 +20,14 @@ const CloneCollection = ({ onClose, collectionUid }) => { const [isEditing, toggleEditing] = useState(false); const collection = useSelector((state) => findCollectionByUid(state.collections.collections, collectionUid)); const preferences = useSelector((state) => state.app.preferences); - const defaultLocation = get(preferences, 'general.defaultCollectionLocation', ''); + const workspaces = useSelector((state) => state.workspaces?.workspaces || []); + const workspaceUid = useSelector((state) => state.workspaces?.activeWorkspaceUid); + const activeWorkspace = workspaces.find((w) => w.uid === workspaceUid); + const isDefaultWorkspace = activeWorkspace?.type === 'default'; + + const defaultLocation = isDefaultWorkspace + ? get(preferences, 'general.defaultCollectionLocation', '') + : (activeWorkspace?.pathname ? `${activeWorkspace.pathname}/collections` : ''); const { name } = collection; const formik = useFormik({