Refactoring admin/delete code

This commit is contained in:
Las Zenow 2012-10-28 17:27:01 +01:00
parent 2e043af31a
commit 1f6fb8565b
2 changed files with 11 additions and 8 deletions

View file

@ -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)