Unverified Commit 80da304a authored by Bhavitvya Malik's avatar Bhavitvya Malik Committed by GitHub
Browse files

updated user permissions based on umask (#11119)

* updated user permissions based on umask

* updated user permissions based on umask

* changes as per suggestions

* minor changes
parent 1a0b4178
...@@ -1535,6 +1535,11 @@ def get_from_cache( ...@@ -1535,6 +1535,11 @@ def get_from_cache(
logger.info(f"storing {url} in cache at {cache_path}") logger.info(f"storing {url} in cache at {cache_path}")
os.replace(temp_file.name, cache_path) os.replace(temp_file.name, cache_path)
# NamedTemporaryFile creates a file with hardwired 0600 perms (ignoring umask), so fixing it.
umask = os.umask(0o666)
os.umask(umask)
os.chmod(cache_path, 0o666 & ~umask)
logger.info(f"creating metadata file for {cache_path}") logger.info(f"creating metadata file for {cache_path}")
meta = {"url": url, "etag": etag} meta = {"url": url, "etag": etag}
meta_path = cache_path + ".json" meta_path = cache_path + ".json"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment