Skip to content

Commit

Permalink
fix pathname for data requests (#4149)
Browse files Browse the repository at this point in the history
### Description

| input file         | HTML pathname | Data pathname    |
| ------------------ | ------------- | ---------------- |
| index.tsx          | /             | .../index.json   |
| blog.tsx           | /blog         | .../blog.json    |
| pricing/index.tsx  | /pricing      | .../pricing.json |
  • Loading branch information
sokra authored Mar 10, 2023
1 parent baf6504 commit 5038d1e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions crates/next-core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit 5038d1e

Please sign in to comment.