1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-10 08:09:06 -05:00

Local filenames starting with 'http' shouldn't be remote. (#1167)

This commit is contained in:
Ryan Dahl 2018-11-08 10:38:54 -08:00 committed by GitHub
parent a18e51fd61
commit 98e6366cb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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> {