Bug: URIError: URI malformed

Bug report

Failed to render Markdown when the next url is used.

https://zenfone4-asus-wiki.fxtec.info/wiki.cgi?page=%C2%D0%B1%FE%A5%CF%A1%BC%A5%C9

Info

  • Platform: (macOS)
  • Platform version: (Sierra/10.12.6)
  • App Version: (3.10.6)

Reproduce

  1. Create new note
  2. Paste https://zenfone4-asus-wiki.fxtec.info/wiki.cgi?page=%C2%D0%B1%FE%A5%CF%A1%BC%A5%C9
  3. Toggle Preview

Show the next stacktrace

Failed to render Markdown
If the problem persists, please report it. Sorry for the inconvenience.
>
URIError: URI malformed
    at decodeURI (<anonymous>:null:null)
    at normalize (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/normalize-uri/index.js:12:20)
    at link (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/handlers/link.js:10:22)
    at one (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/one.js:28:51)
    at all (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/all.js:18:14)
    at paragraph (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js:9:23)
    at one (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/one.js:28:51)
    at all (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/all.js:18:14)
    at root (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/handlers/root.js:11:41)
    at one (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/one.js:28:51)
    at toHAST (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/mdast-util-to-hast/lib/index.js:92:14)
    at compile (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/remark-react/index.js:84:17)
    at Function.stringify (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:349:12)
    at pipelineStringify (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:40:25)
    at wrapped (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:128:19)
    at next (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:81:24)
    at done (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:163:12)
    at done (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:34:7)
    at done (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:308:11)
    at next (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:83:14)
    at Object.run (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:48:10)
    at executor (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:299:20)
    at Function.run (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:296:5)
    at pipelineRun (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:26:5)
    at wrapped (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:128:19)
    at next (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:81:24)
    at done (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:163:12)
    at then (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:174:5)
    at wrapped (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:149:9)
    at next (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:81:24)
    at Object.run (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/trough/index.js:48:10)
    at executor (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:371:16)
    at Function.process (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/unified/index.js:366:5)
    at file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:1:66472
    at Object.<anonymous> (file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:1:66444)
    at tryCatch (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
    at F (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/node_modules/core-js/library/modules/_export.js:35:28)
    at /Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12
    at file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:1:67351
    at Object.action (/Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/alt/lib/actions/index.js:47:24)
    at r (file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:1:56301)
    at file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:1:59514
    at /Applications/Inkdrop.app/Contents/Resources/app.asar/node_modules/lodash/index.js:1773:43

Hi Nakajima-san,

Thank you for reporting.
This behavior is intended because the url is malformed as the error message says.

If you run below code on the browser, you will get same error:

decodeURI('https://zenfone4-asus-wiki.fxtec.info/wiki.cgi?page=%C2%D0%B1%FE%A5%CF%A1%BC%A5%C9')
// -> VM218:1 Uncaught URIError: URI malformed
//      at decodeURI (<anonymous>)
//      at <anonymous>:1:1

This is because the URI-encoded part is not in UTF-8.
RFC 3986: http://tools.ietf.org/html/rfc3986#section-2.5

Please shorten invalid URLs to avoid the issue.

1 Like