1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Deno.makeTempDir() check permissions (#3810)

This commit is contained in:
EnokMan 2020-01-29 22:21:41 -06:00 committed by GitHub
parent 73a3cc21d0
commit 1c6c6c6d7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -539,13 +539,13 @@ fn op_make_temp_dir(
) -> Result<JsonOp, ErrBox> { ) -> Result<JsonOp, ErrBox> {
let args: MakeTempDirArgs = serde_json::from_value(args)?; let args: MakeTempDirArgs = serde_json::from_value(args)?;
// FIXME
state.check_write(Path::new("make_temp"))?;
let dir = args.dir.map(PathBuf::from); let dir = args.dir.map(PathBuf::from);
let prefix = args.prefix.map(String::from); let prefix = args.prefix.map(String::from);
let suffix = args.suffix.map(String::from); let suffix = args.suffix.map(String::from);
state
.check_write(dir.clone().unwrap_or_else(std::env::temp_dir).as_path())?;
let is_sync = args.promise_id.is_none(); let is_sync = args.promise_id.is_none();
blocking_json(is_sync, move || { blocking_json(is_sync, move || {
// TODO(piscisaureus): use byte vector for paths, not a string. // TODO(piscisaureus): use byte vector for paths, not a string.