Library should validate URIs more

Issue #44 resolved
Craig Lawrence created an issue

Investigation

These unmarked up links are handled in LinkTextParser.

So far it’s unclear why we’re getting "href" : "http://'" as a link because trimBadEndChars should be removing the single quote (but I haven’t done debugger testing), so that’s probably the place to start.


The library attempts to build href from a single quote ', but the typescript transformer doesn't accept this as valid.

Wiki

http://

http://'                <-- this one is different in output

http://localhost

Typescript ADF

{
  "version": 1,
  "type": "doc",
  "content": [
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "http://"
        }
      ]
    },
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "http://'"
        }
      ]
    },
    {
      "type": "paragraph",
      "content": [
        {
          "type": "text",
          "text": "http://localhost",
          "marks": [
            {
              "type": "link",
              "attrs": {
                "href": "http://localhost/"
              }
            }
          ]
        }
      ]
    }
  ]
}

Lib ADF

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "http://"
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "http://'",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "http://'"
        }
      } ]
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "http://localhost",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "http://localhost"
        }
      } ]
    } ]
  } ]
}

Comments (4)

  1. Log in to comment