You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/03/13 22:45:07 UTC

[GitHub] [couchdb-documentation] sztanyoo opened a new issue #507: Required content-type header is not enforced when putting attachments

sztanyoo opened a new issue #507: Required content-type header is not enforced when putting attachments
URL: https://github.com/apache/couchdb-documentation/issues/507
 
 
   ## Description
   
   According to https://docs.couchdb.org/en/stable/api/document/attachments.html#put--db-docid-attname Content-Type is a required header in case of adding new attachment.
   However, attachments can be created without specifying the content type
   
   ## Steps to Reproduce
   ```
   curl -v -X PUT  http://xxx:yyy@localhost:5984/database/25/asdf.jpg?rev=5-6c8c656d493947cd111370956d87745e --upload-file ~/Documents/asdf.jpg
   *   Trying ::1...
   * TCP_NODELAY set
   * Connected to localhost (::1) port 5984 (#0)
   * Server auth using Basic with user 'xxx'
   > PUT /database/25/asdf.jpg?rev=5-6c8c656d493947cd111370956d87745e HTTP/1.1
   > Host: localhost:5984
   > Authorization: Basic xxxxxx
   > User-Agent: curl/7.54.0
   > Accept: */*
   > Content-Length: 94733
   > Expect: 100-continue
   >
   < HTTP/1.1 100 Continue
   < Connection: close
   < Date: Tue, 27 Aug 2019 13:26:18 GMT
   < Server: MochiWeb/1.0 (Any of you quaids got a smint?)
   * We are completely uploaded and fine
   < HTTP/1.1 201 Created
   < Cache-Control: must-revalidate
   < Content-Length: 65
   < Content-Type: application/json
   < Date: Tue, 27 Aug 2019 13:26:18 GMT
   < Location: http://localhost:5984/database/25/asdf.jpg
   < Server: CouchDB/2.3.1 (Erlang OTP/19)
   < X-Couch-Request-ID: ba2950c6cf
   < X-CouchDB-Body-Time: 0
   <
   {"ok":true,"id":"25","rev":"6-5e71a7080f3661108237954db783c0bf"}
   ```
   ## Expected Behaviour
   
   When required header is not provided 400 Bad Request should be provided.
   
   ## Your Environment
   
   {"couchdb":"Welcome","version":"2.3.1","git_sha":"c298091a4","uuid":"8f9306c0bae0dddec670160224ec140e","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
   
   CouchDB Version used: 2.3.1
   Browser name and version: curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
   Operating System and version: mac OS Mojave 10.14.6

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb-documentation] wohali commented on issue #507: Content-type header is not required when putting attachments

Posted by GitBox <gi...@apache.org>.
wohali commented on issue #507: Content-type header is not required when putting attachments
URL: https://github.com/apache/couchdb-documentation/issues/507#issuecomment-615917291
 
 
   A PR to fix the documentation is welcome!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb-documentation] wohali closed issue #507: Content-type header is not required when putting attachments

Posted by GitBox <gi...@apache.org>.
wohali closed issue #507: Content-type header is not required when putting attachments
URL: https://github.com/apache/couchdb-documentation/issues/507
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb-documentation] wohali commented on issue #507: Content-type header is not required when putting attachments

Posted by GitBox <gi...@apache.org>.
wohali commented on issue #507: Content-type header is not required when putting attachments
URL: https://github.com/apache/couchdb-documentation/issues/507#issuecomment-598961813
 
 
   I believe in this case, all attempts to retrive the attachment will have a content header type of `application/octet-stream`, but please test to be sure before patching the docs.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb-documentation] sztanyoo commented on issue #507: Content-type header is not required when putting attachments

Posted by GitBox <gi...@apache.org>.
sztanyoo commented on issue #507: Content-type header is not required when putting attachments
URL: https://github.com/apache/couchdb-documentation/issues/507#issuecomment-615882299
 
 
   @wohali , you're right. If "Content-Type" header is not specified during attachment creation, then it will be "application/octet-stream" at retrieval - regardless of the actual file contents.
   
   The issue with the documentation is that it marks "Content-Type" header as required. However, it seems to me that one can make requests without sending this header.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb-documentation] sztanyoo commented on issue #507: Content-type header is not required when putting attachments

Posted by GitBox <gi...@apache.org>.
sztanyoo commented on issue #507: Content-type header is not required when putting attachments
URL: https://github.com/apache/couchdb-documentation/issues/507#issuecomment-615926370
 
 
   Here you are. Sorry for not sending it earlier. Feel free to re-word - if needed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services