PouchDB Attachments Sync Test

Current PouchDB downloads all attachments from all revisions when replicating from a remote repository, instead of smartly checking what attachments already exist locally. The related GitHub issue is #2674

Test Case

You need a CouchDB running to reproduce the issue. We assume we have one at http://localhost:5984 with cors.origins set to *

  1. In CouchDB
    1. Create a database sync-test in your CouchDB
    2. Create document {"_id": "profile"}
  2. In Browser console
    1. Run var db = new PouchDB('mydb')
    2. Run db.replicate.from('http://localhost:5984/sync-test', {live: true})
  3. In CouchDB Futon
    1. Upload attachment at http://localhost:5984/_utils/document.html?sync-test/profile (You can use low-profile-dog-1.png if you like)
    2. Upload another attachment at http://localhost:5984/_utils/document.html?sync-test/profile (You can use low-profile-dog-2.png if you like)
  4. In Browser Web Developer tools, check the network tab. You should see that low-profile-dog-1.png (or what ever your 1st attachment was) was loaded twice by PouchDB, which is inefficient

We have uploaded all requests for reference as pouchdb-requests.har. You can open the file direcly in Chrome, or you can upload it to ericduran.github.io/chromeHAR