Skip to content

Commit

Permalink
fix: Some symbols in the page’s ‘Dynamic path’ input cause the builde…
Browse files Browse the repository at this point in the history
…r to crash. (#4246)

## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
  • Loading branch information
istarkov authored Oct 8, 2024
1 parent 9ad1c1a commit a78c977
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ export const truncate = (pageUrl: string, maxLength = 53) => {
};

export const formatUrl = (urlString: string) => {
const url = new URL(urlString);
try {
const url = new URL(urlString);

return `${url.origin}${url.pathname.split("/").join(" › ")}`;
return `${url.origin}${url.pathname.split("/").join(" › ")}`;
} catch {
return urlString;
}
};

0 comments on commit a78c977

Please sign in to comment.