Thanks Rodrigo.

When you suggested rewriting the FileSystem I re-implemented 
src/net/http/fs.go and it seems the offender is in the serveFile function:

if d.IsDir() {
if checkLastModified(w, r, d.ModTime()) {
return
}
//dirList(w, f) <-here
return
} 

This seems to be working. I will try your suggestion and see which seems to 
be easier.

Thanks again,
toby 


On Thursday, September 15, 2016 at 4:40:46 PM UTC-4, tobyjaguar wrote:
>
> Is possible to serve a directory, http.FileServer(http.Dir(".")), without 
> listing the directory contents of that directory by navigating one folder 
> above it in the browser?
>
> http.Handle("/img/", http.FileServer(http.Dir("static")))
>
> <img src="/img/image.jpg> is served, but the browser will index everything 
> in /img/
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to