Why does python present the url (instead of base combined with url) when a url starts with mailto?
This is what happened:
from urllib.parse import urljoin
>>> urljoin('http://www.w3.org/Consortium/mission.html', 'mailto:site-comments@w3.org')
'mailto:site-comments@w3.org'
but I expected the result to be:
'http://www.w3.org/Consortium/mailto:site-comments@w3.org'
Since:
>>> urljoin('http://www.w3.org/Consortium/mission.html', 'thing')
'http://http://www.w3.org/Consortium/thing'
(Also see: Python: confusions with urljoin)
At first I thought the mailto is present in the result, because mailto is an absolute URL.. But mailto doesn't start with // or scheme://, so it isn't an absolute URL.
Note: If url is an absolute URL (that is, starting with // or scheme://), the url‘s host name and/or scheme will be present in the result.
See: https://docs.python.org/3.0/library/urllib.parse.html
So, if 'mailto:' isn't an absolute URL, why is 'mailto:' the resulting url? It is the behavior I want, but I just don't understand why it happens.