Skip to content

Commit 77187da

Browse files
committed
Bugfix returned path sometimes empty
1 parent 9b1d1ba commit 77187da

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lup-language",
3-
"version": "2.2.4",
3+
"version": "2.2.5",
44
"description": "Node express middleware for detecting requested language",
55
"files": [
66
"lib/**/*"

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,11 @@ export const LanguageRouter = (options?: LanguageRouterOptions): LanguageDetecti
733733
: uri;
734734
const queryIdx = uri.indexOf('?');
735735

736-
return { uriWithQuery: uri, lang, uriWithoutQuery: queryIdx >= 0 ? uri.substring(0, queryIdx) : uri };
736+
return {
737+
uriWithQuery: uri || '/',
738+
lang,
739+
uriWithoutQuery: (queryIdx >= 0 ? uri.substring(0, queryIdx) : uri) || '/',
740+
};
737741
}
738742

739743
/**

0 commit comments

Comments
 (0)