Invalid attachment data on server error when getting doc with attachments

オープン
#8,998 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
javascript, node.js
領域
database

調査の方向性

nginx と CouchDB のセットアップで gist の再現を実行し、次に packages/node_modules/pouchdb-core/src/adapter.js の 665 行目を調べます。そこでは attachment リクエストのエラーが処理されていません。失敗した attachment リクエストによって、サーバーのエラーレスポンスを attachment データとして保存するのではなく、ドキュメントリクエストがエラーをスローするようになれば、issue は完了です。

索引モデルが issue の本文から書いたものです。

説明

Issue

When requesting a doc with attachments, if an attachment request fails, the doc attachment data will save the error message, instead of failing the request, resulting in invalid attachments.

This can happen during replication, bulkGet, etc.

Info
  • Environment: node.js, browser
  • Adapter: http (?)
  • Server: CouchDb
Reproduce

Here's the gist: https://gist.github.com/dianabarsan/c08f5fc114c221a99d2afad7c870bf76

It adds a minimal nginx config that responds with a 400 to an attachment request, and proxies all other requests to a vanilla CouchDb 3.4.2, using docker compose.
Has a Javascript file that:

  • creates a database
  • creates a doc with a plain text attachment
  • initializes a PouchDb connection and does a db.get and logs the content of the attachment, which is the default nginx html error page for 400.

Desired behavior here would be to throw an error when the attachment get request responds with an error.

Faulty code is here:
https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-core/src/adapter.js#L665 where the potential error is not handled.

主要言語
JavaScript
スター
17.6k
フォーク
1.5k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/pouchdb のほかの issue

apache/pouchdb の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。