cocoakekeyu / markdown-img-paste

一个可以快速粘贴剪贴板里的照片到markdown的插件,并且可以设置使用七牛存储照片。
MIT License
179 stars 28 forks source link

七牛云上传错误 #1

Closed ygcaicn closed 5 years ago

ygcaicn commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.11.1 Electron Version: 0.37.8 System: Unknown Windows Version Thrown From: markdown-img-paste package, v0.3.2

Stack Trace

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

At C:\Users\YGC\.atom\packages\markdown-img-paste\node_modules\sync-request\index.js:10

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

    at Object.<anonymous> (C:\Users\YGC\.atom\packages\markdown-img-paste\node_modules\sync-request\index.js:10:1)
    at Module._compile (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (C:\Users\YGC\.atom\packages\markdown-img-paste\node_modules\qiniu\qiniu\zone.js:1:94)
    at Module._compile (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (C:\Users\YGC\.atom\packages\markdown-img-paste\node_modules\qiniu\qiniu\io.js:11:12)
    at Module._compile (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (C:\Users\YGC\.atom\packages\markdown-img-paste\node_modules\qiniu\index.js:8:7)
    at Module._compile (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.module.exports.paste (file:///C:/Users/YGC/.atom/packages/markdown-img-paste/lib/markdown-img-paste.coffee:73:21)
    at atom-workspace.subscriptions.add.atom.commands.add.markdown-img-paste:paste (file:///C:/Users/YGC/.atom/packages/markdown-img-paste/lib/markdown-img-paste.coffee:13:46)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\window-event-handler.js:114:36)
    at HTMLDocument.<anonymous> (C:\Users\YGC\AppData\Local\atom\app-1.11.1\resources\app.asar\src\window-event-handler.js:3:61)

Commands

  4x -4:47.1.0 core:save (atom-text-editor#markdown-img-paste.zdomain.editor.mini.is-focused)
  2x -4:09.4.0 markdown-img-paste:paste (atom-text-editor.editor.is-focused)
     -3:50.4.0 markdown-preview:toggle (atom-text-editor.editor.is-focused)
  2x -3:45.1.0 editor:newline (atom-text-editor.editor.is-focused)
     -3:32.5.0 markdown-img-paste:paste (atom-text-editor.editor.is-focused)
     -3:14.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -3:12.8.0 core:delete (atom-text-editor.editor.is-focused)
 11x -3:11.7.0 core:backspace (atom-text-editor.editor.is-focused)
     -2:45.8.0 core:delete (atom-text-editor.editor.is-focused)
 26x -0:08.0 core:move-right (atom-text-editor.editor.is-focused)
  2x -0:05.8.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:03.7.0 markdown-img-paste:paste (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "projectHome": "D:/Github",
    "telemetryConsent": "limited",
    "themes": [
      "atom-dark-ui",
      "base16-tomorrow-light-theme"
    ]
  },
  "markdown-img-paste": {
    "upload_to_qiniu": true,
    "zAccessKey": "*******************************************",
    "zSecretKey": "********************************",
    "zbucket": "public",
    "zdomain": "http://pubcdn.***********.com/"
  }
}

Installed Packages

# User
atom-html-preview, v0.1.22 (active)
github-atom-light-syntax, v0.2.0 (inactive)
isotope-ui, v2.7.1 (inactive)
markdown-img-paste, v0.3.2 (active)
atom-dark-syntax, v0.27.0 (inactive)
atom-dark-ui, v0.52.0 (active)
atom-light-syntax, v0.28.0 (inactive)
atom-light-ui, v0.44.0 (inactive)
base16-tomorrow-dark-theme, v1.2.0 (inactive)
base16-tomorrow-light-theme, v1.2.0 (active)
one-dark-ui, v1.6.0 (inactive)
one-light-ui, v1.6.0 (inactive)
one-dark-syntax, v1.3.0 (inactive)
one-light-syntax, v1.3.0 (inactive)
solarized-dark-syntax, v1.0.2 (inactive)
solarized-light-syntax, v1.0.2 (inactive)
about, v1.7.0 (active)
archive-view, v0.61.1 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.11.2 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.31.1 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (active)
background-tips, v0.26.1 (active)
bookmarks, v0.42.0 (active)
bracket-matcher, v0.82.1 (active)
command-palette, v0.38.0 (inactive)
deprecation-cop, v0.54.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.40.0 (active)
find-and-replace, v0.201.1 (inactive)
fuzzy-finder, v1.4.0 (active)
git-diff, v1.1.0 (active)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.2 (active)
image-view, v0.59.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.0 (active)
link, v0.31.1 (inactive)
markdown-preview, v0.158.0 (active)
metrics, v1.0.0 (active)
notifications, v0.65.1 (active)
open-on-github, v1.2.0 (inactive)
package-generator, v1.0.0 (inactive)
settings-view, v0.242.2 (active)
snippets, v1.0.2 (active)
spell-check, v0.68.2 (active)
status-bar, v1.4.1 (active)
styleguide, v0.47.0 (active)
symbols-view, v0.113.1 (inactive)
tabs, v0.101.0 (active)
timecop, v0.33.2 (active)
tree-view, v0.209.3 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.35.1 (active)
whitespace, v0.33.0 (active)
wrap-guide, v0.38.2 (active)
language-c, v0.52.1 (active)
language-clojure, v0.21.0 (active)
language-coffee-script, v0.47.2 (active)
language-csharp, v0.12.1 (active)
language-css, v0.37.1 (active)
language-gfm, v0.88.0 (active)
language-git, v0.15.0 (active)
language-go, v0.42.1 (active)
language-html, v0.45.1 (active)
language-hyperlink, v0.16.0 (active)
language-java, v0.23.0 (active)
language-javascript, v0.119.0 (active)
language-json, v0.18.2 (active)
language-less, v0.29.5 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.35.0 (active)
language-php, v0.37.2 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.0 (active)
language-ruby, v0.69.0 (active)
language-ruby-on-rails, v0.25.0 (active)
language-sass, v0.56.0 (active)
language-shellscript, v0.22.4 (active)
language-source, v0.9.0 (active)
language-sql, v0.23.0 (active)
language-text, v0.7.1 (active)
language-todo, v0.28.0 (active)
language-toml, v0.18.0 (active)
language-xml, v0.34.9 (active)
language-yaml, v0.26.0 (active)

# Dev
No dev packages
houzw commented 8 years ago

同样的问题。好像是Chrome Webapps问题 https://developer.chrome.com/extensions/contentSecurityPolicy

cocoakekeyu commented 8 years ago

这个问题比较麻烦,没有一个很好的切入点。应该跟使用环境有关,使用的第三方库中一些代码不能通过安全模式校验,目前暂没找到很好的解决方式。

ericluo commented 8 years ago

我也有同样的问题。

houzw commented 8 years ago

@cocoakekeyu 好几款Atom的插件都有这个问题。不知道这个内容有没有用 ,我不太懂 http://open.chrome.360.cn/extension_dev/contentSecurityPolicy.html

cocoakekeyu commented 7 years ago

问题与 #5 一致, 我已发布新版。

evolutionjay commented 7 years ago

@cocoakekeyu 新版试了一下,我是直接用Mac自带的截图,然后直接 粘贴。 出现一个错误

2017-03-25 6 37 34
cocoakekeyu commented 7 years ago

@evolutionjay 恩,七牛云返回的错误。我又发了一个新版0.3.7, 可以看具体是什么错误。

evolutionjay commented 7 years ago
2017-03-25 7 20 56
cocoakekeyu commented 7 years ago

@evolutionjay 七牛云的API增加了上传服务器的选择,旧版SDK不支持自动选择服务器,新版SDK引用的库又有CSP问题。 我暂时加个上传服务器域名选项,填入你的区域上传域名吧。更新了0.3.8版╮( ̄▽ ̄)╭ 这得提个工单给七牛

wghglory commented 7 years ago

最新版本0.3.8应该解决这个问题了

evolutionjay commented 7 years ago

牛X, 不到一天时间就 fixed 了。 这个可以Close 了,感谢作者

cocoakekeyu commented 7 years ago

哈,不过你可以看一下这个issue的打开日期。

ToSeven commented 7 years ago

上传服务器域名应该填什么啊? 84 是绑定域名吗?

cocoakekeyu commented 7 years ago

@ToSeven 一般不用设置上传域名。如果空间的区域不在默认上传域名会提示需使用你的空间区域的上传域名。

ToSeven commented 7 years ago

@cocoakekeyu 喔喔可以上传了 但是为什么我的只有截图的时候才起作用 复制图片时根本没有反应

Keybird0 commented 6 years ago

Upload Failed:RequestError: connect ECONNREFUSED 127.0.0.1:80 这个怎么处理?

cocoakekeyu commented 6 years ago

@Keybird0 可以重现的吗?

HuBlanker commented 6 years ago

@Keybird0 可以重现的吗?

你好,我这里应该是复现了。 一切按着教程来的,设置使用七牛云,填写了AK,SK,bucket,domain,以及上传服务器. 我自己感觉可能有问题点的地方在:我的七牛域名填写的是官方给的测试域名。 image @cocoakekeyu

cocoakekeyu commented 6 years ago

@HuBlanker 上传服务器一般留空使用默认的, 这个像是发请求到自己的机器。

如果能复制错误栈出来更好定位问题。

HuBlanker commented 6 years ago

@cocoakekeyu 没有修改任何参数。 disable掉使用其他插件,后重新开启,工作正常了。。。 感谢回复!