all repos — litestore @ cde14c25dae848392fa6c6b1abbb83b2c88850a6

A minimalist nosql document store.

Merge pull request #63 from tomidery/fix-minor-bugs

Fabio Cevasco h3rald@h3rald.com
Tue, 06 Apr 2021 16:25:06 +0200
commit

cde14c25dae848392fa6c6b1abbb83b2c88850a6

parent

f17a27e871c65d2d25b936f1eea2c1c49530faed

3 files changed, 6 insertions(+), 3 deletions(-)

jump to
M .gitignore.gitignore

@@ -19,3 +19,4 @@ *_backup

./config.json *.db-shm *.db-wal +*.nim.bak
M src/litestorepkg/lib/api_v7.nimsrc/litestorepkg/lib/api_v7.nim

@@ -707,7 +707,9 @@ else:

return resError(Http400, "Bad request: patch operation #$1 is malformed." % $c) c.inc if apply: - if origData.len > 0 and origData != data: + # when document is not JSON the origData is not defined + # the extra check allows editing tags for non-JSON documents + if origData != nil and origData.len > 0 and origData != data: try: var doc = LS.store.updateDocument(id, data.pretty, "application/json") if doc == "":
M src/litestorepkg/lib/server.nimsrc/litestorepkg/lib/server.nim

@@ -248,12 +248,12 @@ return result

req.route PEG_DEFAULT_URL: info.version = "v7" info.resource = matches[0] - info.id = matches[1] + info.id = matches[1].decodeUrl return req.processApiUrl(LS, info) req.route PEG_URL: info.version = matches[0] info.resource = matches[1] - info.id = matches[2] + info.id = matches[2].decodeUrl return req.processApiUrl(LS, info) raise newException(EInvalidRequest, req.getReqInfo()) except EInvalidRequest: