Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 5ea9186

Browse files
committed
Use X_RELATIVE_PATH when available
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
1 parent 9a5640a commit 5ea9186

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

fileserver.gr

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ let serve = (path) => {
4545
}
4646

4747
let guestpath = (env) => {
48-
let req = Option.unwrap(Map.get("PATH_INFO", env))
49-
let matched = Option.unwrap(Map.get("X_MATCHED_ROUTE", env))
50-
let base = Stringutil.beforeLast("/...", matched)
51-
String.slice(String.length(base) + 1, String.length(req), req)
48+
match (Map.get("X_RELATIVE_PATH", env)) {
49+
Some(p) => p,
50+
None => {
51+
// Backwards compat until Wagi 0.1.0 is released
52+
let req = Option.unwrap(Map.get("PATH_INFO", env))
53+
let matched = Option.unwrap(Map.get("X_MATCHED_ROUTE", env))
54+
let base = Stringutil.beforeLast("/...", matched)
55+
String.slice(String.length(base) + 1, String.length(req), req)
56+
}
57+
}
58+
5259
}
5360

5461
let notFound = () => {

0 commit comments

Comments
 (0)