minor bug fixes during serving of gophermap / dir listings
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
parent
4fee274ed5
commit
2c9d68c2ac
2
file.go
2
file.go
@ -77,7 +77,6 @@ func bufferedRead(path string) ([]byte, *GophorError) {
|
||||
/* Open file */
|
||||
fd, err := os.Open(path)
|
||||
if err != nil {
|
||||
logSystemError("failed to open %s: %s\n", path, err.Error())
|
||||
return nil, &GophorError{ FileOpenErr, err }
|
||||
}
|
||||
defer fd.Close()
|
||||
@ -98,7 +97,6 @@ func bufferedRead(path string) ([]byte, *GophorError) {
|
||||
break
|
||||
}
|
||||
|
||||
logSystemError("failed to read %s: %s\n", path, err.Error())
|
||||
return nil, &GophorError{ FileReadErr, err }
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,8 @@ func (worker *Worker) Respond(data []byte) *GophorError {
|
||||
/* Directory */
|
||||
case Dir:
|
||||
/* First try to serve gopher map */
|
||||
requestPath = path.Join(requestPath, "/"+GophermapFileStr)
|
||||
fileContents, gophorErr := GophermapCache.Fetch(requestPath)
|
||||
gophermapPath := path.Join(requestPath, "/"+GophermapFileStr)
|
||||
fileContents, gophorErr := GophermapCache.Fetch(gophermapPath)
|
||||
if gophorErr != nil {
|
||||
/* Get directory listing instead */
|
||||
fileContents, gophorErr = listDir(requestPath, map[string]bool{})
|
||||
@ -201,7 +201,7 @@ func (worker *Worker) Respond(data []byte) *GophorError {
|
||||
} else {
|
||||
/* Successfully loaded gophermap, add fileContents to response */
|
||||
response = append(response, fileContents...)
|
||||
worker.Log("server gophermap: %s\n", requestPath)
|
||||
worker.Log("serve gophermap: %s\n", gophermapPath)
|
||||
}
|
||||
|
||||
/* Regular file */
|
||||
|
Loading…
Reference in New Issue
Block a user