Skip to content

Creating index with empty "name"/"ddoc" should return 400#3990

Merged
tonysun83 merged 1 commit intoapache:3.xfrom
jiahuili430:1472-fix-index-with-empty-ddoc
Apr 26, 2022
Merged

Creating index with empty "name"/"ddoc" should return 400#3990
tonysun83 merged 1 commit intoapache:3.xfrom
jiahuili430:1472-fix-index-with-empty-ddoc

Conversation

@jiahuili430
Copy link
Contributor

@jiahuili430 jiahuili430 commented Apr 11, 2022

Overview

Creating an index with "ddoc":"" or "name":"" should return a 400 Bad Request.

Testing recommendations

curl -X DELETE $db/abc && curl -X PUT $db/abc
curl -X POST $db/abc/_index -H 'Content-Type: application/json' -d '{"ddoc": "", "index": {"fields": ["foo"]}}'
curl -X POST $db/abc/_index -H 'Content-Type: application/json' -d '{"name": "", "index": {"fields": ["bar"]}}'

{"error":"invalid_empty_string","reason":"Index name/ddoc cannot be empty"}

Related Issues or Pull Requests

#1472

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation

@jiahuili430 jiahuili430 marked this pull request as ready for review April 11, 2022 13:55
@jiahuili430 jiahuili430 changed the title Fix index creation with empty ddoc Creating index with "ddoc":"" should return 400 Bad Request Apr 11, 2022
@jiahuili430 jiahuili430 force-pushed the 1472-fix-index-with-empty-ddoc branch 4 times, most recently from e1895d5 to cfe8979 Compare April 14, 2022 12:42
@jiahuili430 jiahuili430 force-pushed the 1472-fix-index-with-empty-ddoc branch 2 times, most recently from 8067cb0 to f944fb2 Compare April 14, 2022 20:39
@jiahuili430 jiahuili430 changed the title Creating index with "ddoc":"" should return 400 Bad Request Creating index with empty "name"/"ddoc" should return 400 Bad Request Apr 14, 2022
@jiahuili430 jiahuili430 changed the title Creating index with empty "name"/"ddoc" should return 400 Bad Request Creating index with empty "name"/"ddoc" should return 400 Apr 14, 2022
@jiahuili430 jiahuili430 force-pushed the 1472-fix-index-with-empty-ddoc branch 3 times, most recently from 5a6cf78 to ea79831 Compare April 22, 2022 14:24
@jiahuili430 jiahuili430 force-pushed the 1472-fix-index-with-empty-ddoc branch from ea79831 to 0e36eef Compare April 22, 2022 19:07
@jiahuili430 jiahuili430 force-pushed the 1472-fix-index-with-empty-ddoc branch 2 times, most recently from 0bd7d44 to 1cd0d12 Compare April 26, 2022 19:53
Creating an index with "ddoc":"" or "name":"" should return a 400 Bad Request.

Testing recommendations:
```
curl -X DELETE $db/abc && curl -X PUT $db/abc
curl -X POST $db/abc/_index -H 'Content-Type: application/json' -d '{"ddoc": "", "index": {"fields": ["foo"]}}'
curl -X POST $db/abc/_index -H 'Content-Type: application/json' -d '{"name": "", "index": {"fields": ["bar"]}}'

{"error":"invalid_empty_string","reason":"Index name/ddoc cannot be empty"}
```

Related Issues: apache#1472
@jiahuili430 jiahuili430 force-pushed the 1472-fix-index-with-empty-ddoc branch from 1cd0d12 to f714678 Compare April 26, 2022 19:56
@tonysun83 tonysun83 merged commit 2f6d509 into apache:3.x Apr 26, 2022
@jiahuili430 jiahuili430 deleted the 1472-fix-index-with-empty-ddoc branch April 26, 2022 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments