all repos — litestore @ 553ded32396366407211f1ac90c57008a67da651

A minimalist nosql document store.

Fixed small bug in file detection in editor; fixed bug in export.
h3rald h3rald@h3rald.com
Sat, 05 Sep 2015 14:47:58 +0200
commit

553ded32396366407211f1ac90c57008a67da651

parent

b61b08c45b52d8a5c5df06337957fcd77f54e745

2 files changed, 8 insertions(+), 5 deletions(-)

jump to
M admin/js/components/editor.jsadmin/js/components/editor.js

@@ -15,7 +15,7 @@ editor.updateMode = function(filename) {

var self = this; var ext = ""; try { - ext = filename.match(/\.(.+)$/)[1]; + ext = filename.match(/\.([a-z0-9]+)$/)[1]; } catch(e) { ext = ""; }
M lib/core.nimlib/core.nim

@@ -372,15 +372,18 @@ LOG.info("Imported $1/$2 files", cFiles, files.len)

proc exportDir*(store: Datastore, dir: string) = let docs = store.db.getAllRows(SQL_SELECT_DOCUMENTS_BY_TAG, "$dir:"&dir) + LOG.info("Exporting $1 files...", docs.len) for doc in docs: - let file = doc[0].unixToNativePath + LOG.debug("Exporting: $1", doc[1]) + let file = doc[1].unixToNativePath var data: string - if doc[3].parseInt == 1: - data = doc[1].decode + if doc[4].parseInt == 1: + data = doc[2].decode else: - data = doc[1] + data = doc[2] file.parentDir.createDir file.writeFile(data) + LOG.info("Done."); proc deleteDir*(store: Datastore, dir: string) = store.db.exec(SQL_DELETE_DOCUMENTS_BY_TAG, "$dir:"&dir)