Skip to content

Commit

Permalink
fix: enforce leading slash when cruding secrets over rest (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-chaturvedi authored Feb 17, 2024
1 parent cd9332c commit 670960f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ def get(self, request):
try:
path = request.headers["path"]
if path:
if not path.startswith("/"):
path = "/" + path
secrets_filter["path"] = path
except:
pass
Expand Down Expand Up @@ -453,6 +455,9 @@ def post(self, request):

try:
path = secret["path"]
# Ensure path starts with a "/"
if not path.startswith("/"):
path = "/" + path
except:
path = "/"
# path = secret["path"] if secret["path"] is not None else "/"
Expand Down Expand Up @@ -533,6 +538,11 @@ def put(self, request):
try:
folder = None
path = secret["path"]

# Ensure path starts with a "/"
if not path.startswith("/"):
path = "/" + path

if path != "/":
folder = create_environment_folder_structure(path, env_id)

Expand Down

0 comments on commit 670960f

Please sign in to comment.