From 98e6366cb5f00b99340466a9adb3aa82850785fa Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 8 Nov 2018 10:38:54 -0800 Subject: [PATCH] Local filenames starting with 'http' shouldn't be remote. (#1167) --- src/deno_dir.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/deno_dir.rs b/src/deno_dir.rs index b59d7b7eeb..cbc25fd635 100644 --- a/src/deno_dir.rs +++ b/src/deno_dir.rs @@ -753,10 +753,26 @@ fn test_resolve_module_6() { assert_eq!(filename, expected_filename); } +#[test] +fn test_resolve_module_7() { + let (_temp_dir, deno_dir) = test_setup(); + + let module_specifier = "http_test.ts"; + let containing_file = add_root!("/Users/rld/src/deno_net/"); + let expected_module_name = add_root!("/Users/rld/src/deno_net/http_test.ts"); + let expected_filename = add_root!("/Users/rld/src/deno_net/http_test.ts"); + + let (module_name, filename) = deno_dir + .resolve_module(module_specifier, containing_file) + .unwrap(); + assert_eq!(module_name, expected_module_name); + assert_eq!(filename, expected_filename); +} + const ASSET_PREFIX: &str = "/$asset$/"; fn is_remote(module_name: &str) -> bool { - module_name.starts_with("http") + module_name.starts_with("http://") || module_name.starts_with("https://") } fn parse_local_or_remote(p: &str) -> Result {