fix: prevent "null" from appearing in console after user selection (#501) (#514)

Ensure a default working directory is returned when fetching the console working directory. Previously, if a user is switched before running any commands, `Cache::get` would return `null`. Now, it defaults to `'~'` if no value exists.

Closes #501.
This commit is contained in:
Dimitar Yanakiev 2025-02-28 20:44:12 +02:00 committed by GitHub
parent 6143eb94b4
commit 4b8e798e66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,7 +63,7 @@ function () use ($server, $request, $ssh, $log, $currentDir) {
public function workingDir(Server $server)
{
return response()->json([
'dir' => Cache::get('console.'.$server->id.'.dir'),
'dir' => Cache::get('console.'.$server->id.'.dir', '~'),
]);
}
}