Skip to content

Commit

Permalink
final tweak needed for http
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Jun 7, 2023
1 parent 25ebd22 commit a5db50a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions http.go
Expand Up @@ -50,14 +50,23 @@ func StartHttpServer() {
var err error

content, err = os.ReadFile(path)

if err != nil {
log.Error().
Str("unique_code", "d063c1fd").
Int("startpos", startPos).
Int("endpos", endPos).
Str("path", path).
Msg("error reading file")
}

content, err = os.ReadFile("/" + path)
if err != nil {
log.Error().
Str("unique_code", "78e24312").
Int("startpos", startPos).
Int("endpos", endPos).
Str("path", path).
Msg("error reading file")
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
}

Expand Down Expand Up @@ -120,7 +129,7 @@ func StartHttpServer() {
if strings.TrimSpace(Directory) != "" {
dirFilePaths = []string{Directory}
}

if FindRoot {
dirFilePaths[0] = gocodewalker.FindRepositoryRoot(dirFilePaths[0])
}
Expand Down

0 comments on commit a5db50a

Please sign in to comment.