mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 15:19:40 -05:00
fix: Use -rw-r--r-- for cache files (#8132)
This commit is contained in:
parent
b9dc2c3521
commit
c4d33e8d77
3 changed files with 6 additions and 4 deletions
|
@ -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)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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"),
|
||||
|
|
Loading…
Reference in a new issue