Skip to content

Commit

Permalink
Local filenames starting with 'http' shouldn't be remote. (#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry authored Nov 8, 2018
1 parent a18e51f commit 98e6366
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/deno_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<url::Url, url::ParseError> {
Expand Down

0 comments on commit 98e6366

Please sign in to comment.