deltachat / message-parser

Parsing of Links, Email adresses, simple text formatting (markdown subset), user mentions, hashtags and more in DeltaChat messages.
https://deltachat.github.io/message-parser/
Other
12 stars 2 forks source link

username is not supported in links #76

Open Simon-Laux opened 5 months ago

Simon-Laux commented 5 months ago

username + password are not supported. note that there are only limited characters supported, the rest needs to be uri encoded. Also note there ca only be a username with no password.

Examples

Just username

Input:

http://username@www.example.com

Actual Output:

[
    {
        "t": "Link",
        "c": {
            "destination": {
                "target": "http://username",
                "hostname": "username",
                "scheme": "http"
            }
        }
    },
    {
        "t": "Text",
        "c": "@www.example.com"
    }
]

Expected Output:

[
    {
        "t": "Link",
        "c": {
            "destination": {
                "target": "http://username@www.example.com",
                "hostname": "username",
                "scheme": "http"
            }
        }
    }
]

Username + Password

Input:

http://username:password@www.example.com

Actual Output:

[
    {
        "t": "Link",
        "c": {
            "destination": {
                "target": "http://username",
                "hostname": "username:password@www.example.co",
                "punycode": {
                    "original_hostname": "username:password@www.example.co",
                    "ascii_hostname": "xn--username:password@www-.example.co",
                    "punycode_encoded_url": "http://username"
                },
                "scheme": "http"
            }
        }
    },
    {
        "t": "Text",
        "c": ":"
    },
    {
        "t": "EmailAddress",
        "c": "password@www.example.com"
    }
]

Expected Output:

[
    {
        "t": "Link",
        "c": {
            "destination": {
                "target": "http://username:password@www.example.com",
                "hostname": "www.example.com",
                "scheme": "http"
            }
        }
    }
]

dclogin scheme

Input:

dclogin://example@nine.testrun.org?p=L%265j%3A%40g%3C3%5C%5Crr&v=1

Actual Output:

[
    {
        "t": "Link",
        "c": {
            "destination": {
                "target": "dclogin://example",
                "hostname": "example",
                "scheme": "dclogin"
            }
        }
    },
    {
        "t": "Text",
        "c": "@nine.testrun.org?p=L%265j%3A%40g%3C3%5C%5Crr&v=1"
    }
]

Expected Output:

[
    {
        "t": "Link",
        "c": {
            "destination": {
                "target": "dclogin://example@nine.testrun.org?p=L%265j%3A%40g%3C3%5C%5Crr&v=1",
                "hostname": "nine.testrun.org",
                "scheme": "dclogin"
            }
        }
    }
]
farooqkz commented 5 months ago

Regarding the DCLOGIN example, shouldn't the hostname be None or null or perhaps nine.testrun.org?

Simon-Laux commented 5 months ago

Regarding the DCLOGIN example, shouldn't the hostname be None or null or perhaps nine.testrun.org?

yes, thanks for noticing

farooqkz commented 5 months ago

Regarding the DCLOGIN example, shouldn't the hostname be None or null or perhaps nine.testrun.org?

yes, thanks for noticing

So which one? Should it be nine.testrun.org