Skip to content

Commit ed1c3c6

Browse files
committed
Refactor, put variable closer to where it is being used
1 parent 9d533cd commit ed1c3c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/internal/local/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
168168
// change this to s.error() and make s.error() write the failPage instead of an error code.
169169

170170
errDesc := q.Get("error_description")
171-
errorDesc := fmt.Errorf(errDesc)
172171

173172
if bytes.Contains(s.errorPage, code) {
174173
s.errorPage = bytes.Replace(s.errorPage, code, []byte(html.EscapeString(headerErr)), 1) // provides XSS protection
@@ -180,6 +179,7 @@ func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
180179

181180
_, _ = w.Write(s.errorPage)
182181

182+
errorDesc := fmt.Errorf(errDesc)
183183
s.putResult(Result{Err: errorDesc})
184184
return
185185
}

0 commit comments

Comments
 (0)