Skip to content

Commit

Permalink
logs: trying to debug file API bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0elliot committed Dec 16, 2023
1 parent a9be22c commit 5dd57f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion files.go
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,8 @@ func HandleCreateFile(resp http.ResponseWriter, request *http.Request) {
}

if workflow.ExecutingOrg.Id != curfile.OrgId {
log.Printf("[DEBUG] Workflow executing org (%s) isn't file Org Id (%s) in file create. %d orgs have access to it.", workflow.ExecutingOrg.Id, curfile.OrgId, len(workflow.Org))

found := false
for _, curorg := range workflow.Org {
if curorg.Id == curfile.OrgId {
Expand All @@ -1325,7 +1327,7 @@ func HandleCreateFile(resp http.ResponseWriter, request *http.Request) {
}

if !found {
log.Printf("[ERROR] Org %s doesn't have access to %s.", curfile.OrgId, curfile.WorkflowId)
log.Printf("[ERROR] Org %s doesn't have access to %s. %s org should instead.", curfile.OrgId, curfile.WorkflowId, curfile.OrgId)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false, "reason": "Error with workflow id or org id"}`))
return
Expand Down

0 comments on commit 5dd57f6

Please sign in to comment.