Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7ebcb5

Browse files
authored
fix: use workspace name when opening links via the terminal (#6077)
This was using the `<workspace>.<agent>` syntax before, which was invalid.
1 parent c82e38e commit e7ebcb5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

site/src/pages/TerminalPage/TerminalPage.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const TerminalPage: FC<
5656
> = ({ renderer }) => {
5757
const navigate = useNavigate()
5858
const styles = useStyles()
59-
const { username, workspace } = useParams()
59+
const { username, workspace: workspaceName } = useParams()
6060
const xtermRef = useRef<HTMLDivElement>(null)
6161
const [terminal, setTerminal] = useState<XTerm.Terminal | null>(null)
6262
const [fitAddon, setFitAddon] = useState<FitAddon | null>(null)
@@ -68,7 +68,7 @@ const TerminalPage: FC<
6868
const command = searchParams.get("command") || undefined
6969
// The workspace name is in the format:
7070
// <workspace name>[.<agent name>]
71-
const workspaceNameParts = workspace?.split(".")
71+
const workspaceNameParts = workspaceName?.split(".")
7272
const [terminalState, sendEvent] = useMachine(terminalMachine, {
7373
context: {
7474
agentName: workspaceNameParts?.[1],
@@ -93,6 +93,7 @@ const TerminalPage: FC<
9393
const isDisconnected = terminalState.matches("disconnected")
9494
const {
9595
workspaceError,
96+
workspace,
9697
workspaceAgentError,
9798
workspaceAgent,
9899
websocketError,
@@ -134,9 +135,9 @@ const TerminalPage: FC<
134135
applicationsHost,
135136
parseInt(url.port),
136137
workspaceAgent.name,
137-
workspace,
138+
workspace.name,
138139
username,
139-
),
140+
) + url.pathname,
140141
)
141142
} catch (ex) {
142143
open(uri)

0 commit comments

Comments
 (0)