File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -871,25 +871,23 @@ func (api *API) handleDevcontainerRecreate(w http.ResponseWriter, r *http.Reques
871
871
872
872
api .mu .Lock ()
873
873
874
- var workspaceFolder string
875
- for _ , dc := range api .knownDevcontainers {
876
- if dc .ID .String () == devcontainerID {
877
- workspaceFolder = dc . WorkspaceFolder
874
+ var dc codersdk. WorkspaceAgentDevcontainer
875
+ for _ , knownDC := range api .knownDevcontainers {
876
+ if knownDC .ID .String () == devcontainerID {
877
+ dc = knownDC
878
878
break
879
879
}
880
880
}
881
-
882
- dc , ok := api .knownDevcontainers [workspaceFolder ]
883
- switch {
884
- case ! ok :
881
+ if dc .ID == uuid .Nil {
885
882
api .mu .Unlock ()
886
883
887
884
httpapi .Write (ctx , w , http .StatusNotFound , codersdk.Response {
888
885
Message : "Devcontainer not found." ,
889
886
Detail : fmt .Sprintf ("Could not find devcontainer with ID: %q" , devcontainerID ),
890
887
})
891
888
return
892
- case dc .Status == codersdk .WorkspaceAgentDevcontainerStatusStarting :
889
+ }
890
+ if dc .Status == codersdk .WorkspaceAgentDevcontainerStatusStarting {
893
891
api .mu .Unlock ()
894
892
895
893
httpapi .Write (ctx , w , http .StatusConflict , codersdk.Response {
You can’t perform that action at this time.
0 commit comments