Change the paths stored on the database
The paths in the database now are relative of the config BOOKS_PATH and COVER_PATH For updating the database this query should be use: for (var i = db.books.find(); i.hasNext(); ) { var book = i.next(); db.books.update({_id: book["_id"]}, {$set: {path: book["path"].slice(6), cover: book["cover"].slice(7), coversmall: book["coversmall"].slice(7)}}); }
This commit is contained in:
parent
34b48f411c
commit
93bd567f8d
9 changed files with 41 additions and 35 deletions
|
@ -43,7 +43,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||
for _, path := range paths {
|
||||
title, err := ParseFile(path)
|
||||
if err != nil {
|
||||
os.Remove(path)
|
||||
os.Remove(NEW_PATH + path)
|
||||
sess.Notify("Problem uploading!", "The file '"+path[len("new/"):]+"' is not a well formed epub", "error")
|
||||
} else {
|
||||
uploaded = uploaded + " '" + title + "'"
|
||||
|
|
Reference in a new issue