all repos — litestore @ d3d64306ef648a13ce4e92dd0184b8cd9fd53e97

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

d3d64306ef648a13ce4e92dd0184b8cd9fd53e97

parent

2ecc1ea94ba91fcc7e4f02d25e69729d0a913a2a

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: