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 {
path
};
let path = if data {
path
let path = if path == "index" && !data {
""
} else {
if path == "index" {
""
} else {
path.strip_suffix("/index").unwrap_or(path)
}
path.strip_suffix("/index").unwrap_or(path)
};
Ok(StringVc::cell(path.to_string()))