We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bb8973 commit 06a89bcCopy full SHA for 06a89bc
unfurler/src/language/lang.ts
@@ -62,15 +62,15 @@ export const languages = languageDict;
62
63
// expects path to start with a leading '/'
64
export function parseLanguageUrl(path) {
65
- const parts = path.split('/');
+ const parts = path.split('/').filter(part => part.length);
66
let lang;
67
let rest;
68
- if (languages[parts[1]]) {
69
- lang = parts[1];
70
- rest = '/' + parts.slice(2).join('/');
+ if (languages[parts[0]]) {
+ lang = parts[0];
+ rest = '/' + parts.slice(1).join('/');
71
} else {
72
lang = null;
73
- rest = path;
+ rest = '/' + parts.join('/');
74
}
75
if (lang === 'en') {
76
0 commit comments