apache / couchdb-fauxton

Fauxton is the new Web UI for CouchDB
https://github.com/apache/couchdb-fauxton
Apache License 2.0
373 stars 225 forks source link

Bug: Fauxton editor does not display all JSON keys of existing records. I.E. a key named "ok" is not loaded #1427

Open hilbix opened 4 months ago

hilbix commented 4 months ago

Expected Behavior

When editing an existing record in a database with Fauxton's editor, the full JSON contents should be displayed and editable.

This includes a top level key ok in the JSON object.

Current Behavior

When editing a JSON with ok key in it, the ok key does not make it into the editing field. Hence if the ok key is not manually entered again before saving the record, the entry ok in the JSON is lost.

In Views and in "All Documents" the JSONs are handled correctly, though, so it is no CouchDB issue, just something specific with the Editor.

Possible Solution

unknown

Steps to Reproduce (for bugs)

  1. Create some empty database test and remove the member role, such that the curl below works
  2. open
    http://127.0.0.1:5984/_utils/#/database/test/_new
  3. create
    { "_id": "where is the ok?", "ok":"hello world" }
  4. open http://127.0.0.1:5984/_utils/#database/test/where%20is%20the%20ok%3F
  5. No "ok" is shown, you only see something like this: { "_id": "where is the ok?", "_rev": "1-0e1f848d38f32bfb95e4ced1f50afcad" }
  6. But curl http://127.0.0.1:5984/run/where+is+the+ok%3F shows, the entry is in there:
    {"_id":"where is the ok?","_rev":"1-0e1f848d38f32bfb95e4ced1f50afcad","ok":"hello world"}
  7. Also views can access and display it correctly, so it luckily only a bug in Fauxton's editor

AFAICS the editor removes the entry when loading a record for some unknown reason.

It is unknown to me, if other entries than ok are affected, too.

Context

I hope this is the right place to report, as I found no better place. And I tried to locate a similar already existing issue but was unable to spot one.

And thanks for CouchDB, of course!

Your Environment

It does not depend on the environment used. Fauxton behaves the same on Debian and Ubuntu:

Fauxton on Apache CouchDB v. 3.3.2

$ dpkg -l couchdb | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Architecture Description
+++-==============-==============-============-==================================
ii  couchdb        3.3.2~bullseye amd64        RESTful document oriented database

Fauxton on Apache CouchDB v. 3.3.3

$ dpkg -l couchdb
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version       Architecture Description
+++-==============-=============-============-==================================
ii  couchdb        3.3.3-1~jammy amd64        RESTful document oriented database

It does not depend on the browser used. Following browsers were tested:

$ dpkg -l firefox-esr | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version                                Architecture Description
+++-==============-======================================-============-======================================
ii  firefox-esr    115.7.0esr+build1-0ubuntu0.22.04.1~mt1 amd64        Safe and easy web browser from Mozilla
$ snap info chromium
name:      chromium
summary:   Chromium web browser, open-source version of Chrome
publisher: Canonical✓
store-url: https://snapcraft.io/chromium
contact:   https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bugs?field.tag=snap
license:   unset
description: |
  An open-source browser project that aims to build a safer, faster, and more
  stable way for all Internet users to experience the web.
commands:
  - chromium.chromedriver
  - chromium
snap-id:      XKEcBqPM06H1Z7zGOdG5fbICuf8NWK5R
tracking:     latest/stable
refresh-date: 11 days ago, at 21:33 CET
channels:
  latest/stable:    121.0.6167.160 2024-02-09 (2749) 167MB -
  latest/candidate: 121.0.6167.160 2024-02-07 (2749) 167MB -
  latest/beta:      122.0.6261.29  2024-02-08 (2754) 167MB -
  latest/edge:      123.0.6286.0   2024-02-09 (2755) 167MB -
installed:          121.0.6167.139            (2742) 167MB -