diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-05-15 16:32:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 16:32:52 +0200 |
commit | 89fe81168e75a375a67e9d391b367d2a9749153c (patch) | |
tree | 167624ec7acdb899e0ddf6a2a45fc093a5c44fc5 /cli/http_cache.rs | |
parent | d4afc9890dfa60a233167e2ea003d9e7c830ee61 (diff) |
fix: panic if $DENO_DIR is a relative path (#5375)
This commit fixes panic occurring if $DENO_DIR is set to a relative
path, eg. "DENO_DIR=denodir deno run main.ts".
Before creating DenoDir instance given path is checked and if necessary
resolved against current working directory.
Additional sanity checks were put in place to ensure all caches
receive absolute path for the location.
Diffstat (limited to 'cli/http_cache.rs')
-rw-r--r-- | cli/http_cache.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/http_cache.rs b/cli/http_cache.rs index 2771cb763..2a9882376 100644 --- a/cli/http_cache.rs +++ b/cli/http_cache.rs @@ -103,7 +103,10 @@ impl Metadata { impl HttpCache { /// Returns a new instance. + /// + /// `location` must be an absolute path. pub fn new(location: &Path) -> Self { + assert!(location.is_absolute()); Self { location: location.to_owned(), } |