rsnext/test/e2e/app-dir/trailingslash
Jiachi Liu 664073e86f
Fix metadata url cases should not append with trailing slash (#63050)
### What

Exclude the cases like external urls and relative urls with query from
appending trailing slash when it's needed.

The process is:
- If it's a uncertain string path (relative url, could start with `'./'`
or `/`), convert to relative that starts with `/`;
- then we covert the url (string or URL) to string url
- We do the check if we need to append the trailing slash

### Why

In #62109 we added functionality that can only append trailing slash
when we appended trailing slash to some metadata url like `canonical`
url and open graph url when the config is enabled.
For urls with queries, the trailing slash can also be omitted.
For the external urls (different origin comparing to `metadataBase`) we
don't need to append trailing slash as they're not the same web app.

x-ref: [slack
thread](https://vercel.slack.com/archives/C0676QZBWKS/p1709845946033929)

Closes NEXT-2762
Closes NEXT-2753
2024-03-08 21:16:16 +01:00
..
app Fix metadata url cases should not append with trailing slash (#63050) 2024-03-08 21:16:16 +01:00
next.config.js Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
trailingslash.test.ts Fix metadata url cases should not append with trailing slash (#63050) 2024-03-08 21:16:16 +01:00