Skip to content

Commit

Permalink
fix cors error
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jan 21, 2025
1 parent 5ee2a3c commit 0a2547d
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions api/tacticalrmm/ee/reporting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,15 +836,10 @@ class QuerySchema(APIView):
def get(self, request):
schema_path = "static/reporting/schemas/query_schema.json"

if djangosettings.DEBUG:
try:
with open(djangosettings.BASE_DIR / schema_path, "r") as f:
data = json.load(f)

return JsonResponse(data)
except FileNotFoundError:
return notify_error("There was an error getting the file")
else:
response = HttpResponse()
response["X-Accel-Redirect"] = f"/{schema_path}"
return response
try:
with open(djangosettings.BASE_DIR / schema_path, "r") as f:
data = json.load(f)

return JsonResponse(data)
except FileNotFoundError:
return notify_error("There was an error getting the file")

0 comments on commit 0a2547d

Please sign in to comment.