Skip to content
Open
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
11 changes: 8 additions & 3 deletions cloud/ide/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,16 @@ func saveSessionAndCleanup(client astrocore.CoreClient, organizationID, workspac
}

// openProjectInBrowser opens the project URL in the default browser
func openProjectInBrowser(client astrocore.CoreClient, organizationID, workspaceID, projectID string, out io.Writer) {
// If sessionID is provided, opens the session URL instead of the project URL
func openProjectInBrowser(client astrocore.CoreClient, organizationID, workspaceID, projectID, sessionID string, out io.Writer) {
projectResp, err := getProject(client, organizationID, workspaceID, projectID)
var url string
if err == nil && projectResp != nil && projectResp.JSON200 != nil && projectResp.JSON200.Url != nil && *projectResp.JSON200.Url != "" {
url = *projectResp.JSON200.Url
// If sessionID is provided, append the session path to the URL
if sessionID != "" {
url = fmt.Sprintf("%s/sessions/%s", url, sessionID)
}
} else {
return
}
Expand Down Expand Up @@ -354,8 +359,8 @@ func ExportProject(client astrocore.CoreClient, projectID, organizationID, works

fmt.Fprintf(out, "Successfully exported project to %s\n", projectID)

// Open project in browser
openProjectInBrowser(client, organizationID, workspaceID, projectID, out)
// Open project session in browser
openProjectInBrowser(client, organizationID, workspaceID, projectID, sessionResp.JSON200.Id, out)

return nil
}
Expand Down