Refactoring admin/delete code
This commit is contained in:
parent
2e043af31a
commit
1f6fb8565b
2 changed files with 11 additions and 8 deletions
10
store.go
10
store.go
|
@ -77,6 +77,16 @@ func StoreBook(book Book) (path string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func DeleteBook(book Book) {
|
||||
if book.Cover != "" {
|
||||
os.RemoveAll(book.Cover[1:])
|
||||
}
|
||||
if book.CoverSmall != "" {
|
||||
os.RemoveAll(book.CoverSmall[1:])
|
||||
}
|
||||
os.RemoveAll(book.Path)
|
||||
}
|
||||
|
||||
func validFileName(path string, title string, extension string) string {
|
||||
title = strings.Replace(title, "/", "_", -1)
|
||||
title = strings.Replace(title, "?", "_", -1)
|
||||
|
|
Reference in a new issue