mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 21:32:55 +01:00
tolerate extra '/'s in unfurler requests
This commit is contained in:
parent
9bb897307f
commit
06a89bc1a7
@ -62,15 +62,15 @@ export const languages = languageDict;
|
||||
|
||||
// expects path to start with a leading '/'
|
||||
export function parseLanguageUrl(path) {
|
||||
const parts = path.split('/');
|
||||
const parts = path.split('/').filter(part => part.length);
|
||||
let lang;
|
||||
let rest;
|
||||
if (languages[parts[1]]) {
|
||||
lang = parts[1];
|
||||
rest = '/' + parts.slice(2).join('/');
|
||||
if (languages[parts[0]]) {
|
||||
lang = parts[0];
|
||||
rest = '/' + parts.slice(1).join('/');
|
||||
} else {
|
||||
lang = null;
|
||||
rest = path;
|
||||
rest = '/' + parts.join('/');
|
||||
}
|
||||
if (lang === 'en') {
|
||||
lang = null;
|
||||
|
Loading…
Reference in New Issue
Block a user