summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/disk_cache.rs2
-rw-r--r--cli/http_cache.rs6
-rw-r--r--cli/main.rs2
3 files changed, 6 insertions, 4 deletions
diff --git a/cli/disk_cache.rs b/cli/disk_cache.rs
index 1fc9b3289..398085cc2 100644
--- a/cli/disk_cache.rs
+++ b/cli/disk_cache.rs
@@ -145,7 +145,7 @@ impl DiskCache {
Some(ref parent) => self.ensure_dir_exists(parent),
None => Ok(()),
}?;
- deno_fs::write_file(&path, data, 0o666)
+ deno_fs::write_file(&path, data, crate::http_cache::CACHE_PERM)
.map_err(|e| with_io_context(&e, format!("{:#?}", &path)))
}
}
diff --git a/cli/http_cache.rs b/cli/http_cache.rs
index 73d569851..7310c9e92 100644
--- a/cli/http_cache.rs
+++ b/cli/http_cache.rs
@@ -17,6 +17,8 @@ use std::io;
use std::path::Path;
use std::path::PathBuf;
+pub const CACHE_PERM: u32 = 0o644;
+
/// Turn base of url (scheme, hostname, port) into a valid filename.
/// This method replaces port part with a special string token (because
/// ":" cannot be used in filename on some platforms).
@@ -85,7 +87,7 @@ impl Metadata {
pub fn write(&self, cache_filename: &Path) -> Result<(), AnyError> {
let metadata_filename = Self::filename(cache_filename);
let json = serde_json::to_string_pretty(self)?;
- deno_fs::write_file(&metadata_filename, json, 0o666)?;
+ deno_fs::write_file(&metadata_filename, json, CACHE_PERM)?;
Ok(())
}
@@ -159,7 +161,7 @@ impl HttpCache {
.expect("Cache filename should have a parent dir");
self.ensure_dir_exists(parent_filename)?;
// Cache content
- deno_fs::write_file(&cache_filename, content, 0o666)?;
+ deno_fs::write_file(&cache_filename, content, CACHE_PERM)?;
let metadata = Metadata {
url: url.to_string(),
diff --git a/cli/main.rs b/cli/main.rs
index 2acdff57d..75677d1fb 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -375,7 +375,7 @@ async fn bundle_command(
if let Some(out_file_) = out_file.as_ref() {
let output_bytes = output.as_bytes();
let output_len = output_bytes.len();
- deno_fs::write_file(out_file_, output_bytes, 0o666)?;
+ deno_fs::write_file(out_file_, output_bytes, 0o644)?;
info!(
"{} {:?} ({})",
colors::green("Emit"),