Compare commits
5 commits
1cd15d51e4
...
a690b76c42
| Author | SHA1 | Date | |
|---|---|---|---|
| a690b76c42 | |||
| 523aa894d0 | |||
| cc05d3b2d3 | |||
| fccba73bac | |||
| 4ee46d8f52 |
2 changed files with 14 additions and 2 deletions
12
README.md
12
README.md
|
|
@ -16,7 +16,17 @@ indir [--host address] [--port port] [--root http_root] directory
|
|||
--root http_root hosts on the specified subdirectory, i.e. `/files/`
|
||||
```
|
||||
|
||||
## customization
|
||||
|
||||
### readme
|
||||
drop a `README.md` into any directory and indir will render
|
||||
it below the file listing with full markdown support!
|
||||
|
||||
---
|
||||
|
||||
## to-do:
|
||||
- [x] use templates instead of hard-coded HTML (i was lazy)
|
||||
- [ ] directory header from readme file
|
||||
- [x] directory header from readme file
|
||||
- [ ] directory stylesheet overrides
|
||||
- [x] index.html serving support
|
||||
- [x] fix mime-types for browser file view
|
||||
4
main.go
4
main.go
|
|
@ -154,7 +154,9 @@ func main() {
|
|||
mimeType := "application/octet-stream"
|
||||
extPos := strings.LastIndex(info.Name(), ".")
|
||||
if extPos != -1 {
|
||||
mimeType = mime.TypeByExtension(info.Name()[:extPos])
|
||||
if m := mime.TypeByExtension(info.Name()[extPos:]); m != "" {
|
||||
mimeType = m
|
||||
}
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", mimeType)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue