fix pathname for data requests (vercel/turbo#4149)

### Description

| input file         | HTML pathname | Data pathname    |
| ------------------ | ------------- | ---------------- |
| index.tsx          | /             | .../index.json   |
| blog.tsx           | /blog         | .../blog.json    |
| pricing/index.tsx  | /pricing      | .../pricing.json |
This commit is contained in:
Tobias Koppers 2023-03-10 09:40:43 +01:00 committed by GitHub
parent 511b244f4a
commit 01f2524392

View file

@ -47,14 +47,10 @@ pub async fn pathname_for_path(
} else { } else {
path path
}; };
let path = if data { let path = if path == "index" && !data {
path ""
} else { } else {
if path == "index" { path.strip_suffix("/index").unwrap_or(path)
""
} else {
path.strip_suffix("/index").unwrap_or(path)
}
}; };
Ok(StringVc::cell(path.to_string())) Ok(StringVc::cell(path.to_string()))