apache / couchdb-fauxton

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

Google Chrome console error, cannot view attachments #1049

Closed sergey-safarov closed 6 years ago

sergey-safarov commented 6 years ago

Expected Behavior

I want to view and download document attachments.

Current Behavior

I cannot view attachments. When document is loaded (with or without attachments) i see console errors as on screenshot.

Possible Solution

not known

Steps to Reproduce (for bugs)

  1. open developer console
  2. open document with attachment
  3. list and download attachments

Context

Database maintenance operations.

Your Environment

Browser console errors:

Refused to create a worker from 'blob:http://217.12.247.99:5984/8b88e74a-0420-4b9a-8f0e-93ec71c30678' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'". Note that 'worker-src' was not explicitly set, so 'script-src' is used as a fallback.
Refused to create a worker from 'blob:http://217.12.247.99:5984/73cbf653-125b-4307-9bd9-db8319fbb6ca' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'". Note that 'worker-src' was not explicitly set, so 'script-src' is used as a fallback.
vendor.884175873da25bb4e526.js:40 Could not load worker DOMException: Failed to construct 'Worker': Access to the script at 'blob:http://217.12.247.99:5984/73cbf653-125b-4307-9bd9-db8319fbb6ca' is denied by the document's Content Security Policy.
    at new l (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:40:380172)
    at h.createWorker (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:40:432335)
    at f.$startWorker (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:40:235407)
    at f.$onChangeMode (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:40:234646)
    at f.setMode (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:40:234168)
    at t.a.setupAce (http://217.12.247.99:5984/_utils/dashboard.assets/js/bundle.25bdeac6d2ce92b30461.js:1:90114)
    at t.value (http://217.12.247.99:5984/_utils/dashboard.assets/js/bundle.25bdeac6d2ce92b30461.js:1:94365)
    at e.notifyAll (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:57:93883)
    at r.close (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:80:266325)
    at r.closeAll (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:76312)
    at r.perform (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:75807)
    at i.perform (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:75724)
    at i.perform (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:23594)
    at Object.k [as flushBatchedUpdates] (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:23763)
    at r.closeAll (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:76312)
    at r.perform (http://217.12.247.99:5984/_utils/dashboard.assets/js/vendor.884175873da25bb4e526.js:16:75807)

fauxton error

popojargo commented 6 years ago

I'm not having the error with the current master branch.

Should we allow blob: as script-src?

popojargo commented 6 years ago

@sergey-safarov What kind of attachment was that?

sergey-safarov commented 6 years ago

Hello Alexis (@popojargo) Database contains mp3 audio files.

Important Console contains same error when opened doc without attachments. I think attachment list is not generated because some of scripts failed.

techniccontroller commented 6 years ago

I am facing the same issue on my CouchDB installation. My version is 2.1.1 (installed from Source) and running on Raspbian Stretch. When I am clicking on "View attachments" nothing happens. My console in the chrome browser shows the same errors. I also tried it with the Edge and Firefox browser with the same result.

My attachments are .png and .jpg image files.

Antonio-Maranhao commented 6 years ago

The issue is fixed on master but it didn't make into the CouchDB 2.1.1 release. It was delivered a few days after the cut: https://github.com/apache/couchdb-fauxton/pull/999

sergey-safarov commented 6 years ago

Thank you @Antonio-Maranhao I closing this ticket

cluxter commented 6 years ago

Same issue here right now with the official Docker image couchdb:2.1.1.

popojargo commented 6 years ago

@cluxter As Antonio said, it was not released yet for 2.1.1 It not expected to be updated in the docker image

chegeiser commented 6 years ago

I've made the edits from #999 in my deployment to actions.js and to components.js but it I still have the problem of not being able to view the attachements (jpg) in Fauxton. I did notice that action.js line 217 deletes a few of items leaving the line as - I assume this should actually be - I've tried both ways and after restarting CouchDB neither way enables attachment viewing. Any ideas how to fix this, or why the problem remains? Thank you, Che

gdelfino commented 6 years ago

I am experiencing this issue to with Firefox. In the meanwhile I am using https://github.com/ermouth/couch-photon to be able to easily download attachments and for IE11 compatibility.