aboutsummaryrefslogtreecommitdiff
path: root/src/http/url_path.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-01-29 23:50:38 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-01-29 23:50:38 -0800
commit14301284afe814261b6c5232c1209c8f9244497f (patch)
tree44e4fb1ac30afd44764ba97fa26693a48acbbf87 /src/http/url_path.zig
parentadeb880d7f3f6be634357a84bbd389f1c2b044c8 (diff)
downloadbun-14301284afe814261b6c5232c1209c8f9244497f.tar.gz
bun-14301284afe814261b6c5232c1209c8f9244497f.tar.zst
bun-14301284afe814261b6c5232c1209c8f9244497f.zip
cleanup
Diffstat (limited to 'src/http/url_path.zig')
-rw-r--r--src/http/url_path.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/http/url_path.zig b/src/http/url_path.zig
index f2c558517..e3e90a60f 100644
--- a/src/http/url_path.zig
+++ b/src/http/url_path.zig
@@ -22,6 +22,12 @@ first_segment: string = "",
query_string: string = "",
needs_redirect: bool = false,
+pub fn isRoot(this: *const URLPath, asset_prefix: string) bool {
+ const without = this.pathWithoutAssetPrefix(asset_prefix);
+ if (without.len == 1 and without[0] == '.') return true;
+ return strings.eqlComptime(without, "index");
+}
+
// TODO: use a real URL parser
// this treats a URL like /_next/ identically to /
pub fn pathWithoutAssetPrefix(this: *const URLPath, asset_prefix: string) string {