Skip to content

Commit

Permalink
fix(i18n): 🐛 fixed locale redirection //
Browse files Browse the repository at this point in the history
  • Loading branch information
arctic-hen7 committed Oct 10, 2021
1 parent 295b875 commit 488a9a0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/perseus/src/locale_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub fn detect_locale(url: String, locales: Locales) {
let url = format!("/{}", url);
let base_path = get_path_prefix_client(); // We know this doesn't have a trailing slash
let loc = url.strip_prefix(&base_path).unwrap_or(&url);
// The location develops a leading slash during the base path stripping, so we remove it (again)
let loc = loc.strip_prefix('/').unwrap_or(loc);
let new_loc = format!("{}/{}/{}", base_path, locale, loc);
let new_loc = new_loc.strip_suffix('/').unwrap_or(&new_loc);

Expand Down

0 comments on commit 488a9a0

Please sign in to comment.