fix: serve workspace chooser at root
This commit is contained in:
@@ -12520,9 +12520,7 @@ fn unscoped_workspace_ui_redirect(
|
|||||||
query: Option<&str>,
|
query: Option<&str>,
|
||||||
workspace_id: &str,
|
workspace_id: &str,
|
||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
let scoped_tail = if path == "/" {
|
let scoped_tail = if ["/repositories", "/objectives", "/settings", "/runtimes"]
|
||||||
""
|
|
||||||
} else if ["/repositories", "/objectives", "/settings", "/runtimes"]
|
|
||||||
.iter()
|
.iter()
|
||||||
.any(|prefix| path == *prefix || path.starts_with(&format!("{prefix}/")))
|
.any(|prefix| path == *prefix || path.starts_with(&format!("{prefix}/")))
|
||||||
{
|
{
|
||||||
@@ -14494,6 +14492,23 @@ mod tests {
|
|||||||
assert_eq!(b["workspace_id"], workspace_b.workspace.workspace_id);
|
assert_eq!(b["workspace_id"], workspace_b.workspace.workspace_id);
|
||||||
assert_eq!(b["display_name"], "Workspace B");
|
assert_eq!(b["display_name"], "Workspace B");
|
||||||
|
|
||||||
|
let chooser = app
|
||||||
|
.clone()
|
||||||
|
.oneshot(Request::builder().uri("/").body(Body::empty()).unwrap())
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(chooser.status(), StatusCode::OK);
|
||||||
|
assert_eq!(
|
||||||
|
String::from_utf8(
|
||||||
|
to_bytes(chooser.into_body(), usize::MAX)
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
|
.to_vec(),
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
"<main>Workspace chooser</main>"
|
||||||
|
);
|
||||||
|
|
||||||
for asset_uri in [
|
for asset_uri in [
|
||||||
"/_app/immutable/entry/start.js".to_string(),
|
"/_app/immutable/entry/start.js".to_string(),
|
||||||
format!(
|
format!(
|
||||||
|
|||||||
Reference in New Issue
Block a user