From a743177282e314a4589dc6be1c7aa63efca3646b Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Wed, 15 Aug 2012 20:15:15 +0200 Subject: [PATCH] Fix cover getter --- upload/upload.go | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/upload/upload.go b/upload/upload.go index d1a4584..b987ad5 100644 --- a/upload/upload.go +++ b/upload/upload.go @@ -21,6 +21,13 @@ const ( RESIZE_THUMB = "/usr/bin/convert -resize 60 -quality 60 " ) +func cleanStr(str string) string { + str = strings.Replace(str, "'", "'", -1) + exp, _ := regexp.Compile("[ ,]*$") + str = exp.ReplaceAllString(str, "") + return str +} + func resize(folder, name, extension string) (string, string) { imgPath := folder + name + extension resize := append(strings.Split(RESIZE, " "), imgPath, imgPath) @@ -49,7 +56,7 @@ func getCover(e *epub.Epub, path string) (string, string) { if n != 0 { return resize(folder, path, ".jpg") } - defer os.Remove(imgPath) + os.Remove(imgPath) exp, _ := regexp.Compile("