In order to allow for URL parameters to have percent signs, I use this code:
<Link to={"project/" + encodeURIComponent(projectName.replace("%", "%25"))}>{projectName}</Link>
The link above takes me to the projects
page. This is how I decode the projectName parameter on the projects
page:
const projectName = decodeURIComponent(match.params.projectName);
This code works. However, if I refresh the projects
page or use the browser back/forward button to navigate to the projects
page, I get an error when decoding. URIError: URI malformed
It looks like the match.params.projectName is already decoded after refreshing / navigating with forward / back buttons. This causes the error to occur.