TypeError building a page with a link with an eD2k URI scheme

15 views
Skip to first unread message

Mariano Draghi

unread,
May 6, 2015, 11:51:01 AM5/6/15
to nikola-...@googlegroups.com
Yeah... I know... eDonkey? Who cares! :p

Anyway, I have an old post with a presumably dead eD2k link, and I really don't care about it (I replaced it with a link to the same content on YouTube), but maybe this happens with other not-so-common URI schemes, and it's worth a look. If it isn't... please feel free to ignore me :) Maybe even urllib doesn't know about eD2k URIs nowadays...

This reST content:

```
.. title: eD2k Link Test
.. slug: ed2k-link-test
.. date: 2015-05-06 15:25:58 UTC
.. tags:
.. category:
.. link:
.. description:
.. type: text

Here is an `eD2k link`_

.. _eD2k link: ed2k://|file|Audio Book - Orson Welles - War Of The Worlds, Original, Uncut.mp3|54878208|B7E6517C258F0062832629718E91FFBC|/

```

Fails to build with this error:

"""
(nikola)mariano@arya:~/Devel/test⟫ nikola build
Scanning posts....done!
.  render_sources:output/posts/ed2k-link-test.rst
.  render_posts:cache/posts/ed2k-link-test.html
.  render_indexes:output/index.html
########################################
TaskError - taskid:render_indexes:output/index.html
PythonAction Error
Traceback (most recent call last):
  File "/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/doit/action.py", line 372, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/nikola/nikola.py", line 968, in render_template
    doc.rewrite_links(lambda dst: self.url_replacer(src, dst, context['lang']))
  File "/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/lxml/html/__init__.py", line 483, in rewrite_links
    new_link = link_repl_func(link.strip())
  File "/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/nikola/nikola.py", line 968, in <lambda>
    doc.rewrite_links(lambda dst: self.url_replacer(src, dst, context['lang']))
  File "/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/nikola/nikola.py", line 1016, in url_replacer
    dst_url.fragment))
  File "/usr/lib/python3.4/urllib/parse.py", line 393, in urlunsplit
    _coerce_args(*components))
  File "/usr/lib/python3.4/urllib/parse.py", line 109, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments

https://example.com/index.html
https://example.com/
ed2k://%7Cfile%7CAudioBook-OrsonWelles-WarOfTheWorlds,Original,Uncut.mp3%7C54878208%7CB7E6517C258F0062832629718E91FFBC%7C/

"""

This is Nikola 7.4.0, on Python 3.4.0, lxml 3.4.4, doit 0.28.0

Please, let me know if I should file this in GitHub or in /dev/null ;-)


--
Mariano


Chris Warrick

unread,
May 6, 2015, 11:56:36 AM5/6/15
to Nikola—Discuss
On Wed, May 6, 2015 at 5:51 PM, Mariano Draghi <mdr...@gmail.com> wrote:
> Yeah... I know... eDonkey? Who cares! :p
>
> Anyway, I have an old post with a presumably dead eD2k link, and I really
> don't care about it (I replaced it with a link to the same content on
> YouTube), but maybe this happens with other not-so-common URI schemes, and
> it's worth a look. If it isn't... please feel free to ignore me :) Maybe
> even urllib doesn't know about eD2k URIs nowadays...
>
> This reST content:
>
> ```
> .. title: eD2k Link Test
> .. slug: ed2k-link-test
> .. date: 2015-05-06 15:25:58 UTC
> .. tags:
> .. category:
> .. link:
> .. description:
> .. type: text
>
> Here is an `eD2k link`_
>
> .. _eD2k link: ed2k://|file|Audio Book - Orson Welles - War Of The Worlds,
> Original, Uncut.mp3|54878208|B7E6517C258F0062832629718E91FFBC|/
>
> ```
>
> Fails to build with this error:
>
> """
> (nikola)mariano@arya:~/Devel/test⟫ nikola build

Valar morghulis.

[snip]
> File
> "/home/mariano/.virtualenvs/nikola/lib/python3.4/site-packages/nikola/nikola.py",
> line 1016, in url_replacer
> dst_url.fragment))
> File "/usr/lib/python3.4/urllib/parse.py", line 393, in urlunsplit
> _coerce_args(*components))
> File "/usr/lib/python3.4/urllib/parse.py", line 109, in _coerce_args
> raise TypeError("Cannot mix str and non-str arguments")
> TypeError: Cannot mix str and non-str arguments
>
> https://example.com/index.html
> https://example.com/
> ed2k://%7Cfile%7CAudioBook-OrsonWelles-WarOfTheWorlds,Original,Uncut.mp3%7C54878208%7CB7E6517C258F0062832629718E91FFBC%7C/
>
> """
>
> This is Nikola 7.4.0, on Python 3.4.0, lxml 3.4.4, doit 0.28.0
>
> Please, let me know if I should file this in GitHub or in /dev/null ;-)

You can file this on GitHub. We probably could just ignore all links
that don’t begin with http[s]:// and link://, we can’t do much to any
other links anyways.

(you don’t have to ask, just file on github, we would just close it as
wontfix if we didn’t care)

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Mariano Draghi

unread,
May 6, 2015, 1:01:13 PM5/6/15
to nikola-...@googlegroups.com
On Wednesday, May 6, 2015 at 12:56:36 PM UTC-3, Chris Warrick wrote:
On Wed, May 6, 2015 at 5:51 PM, Mariano Draghi <mdr...@gmail.com> wrote:
> Yeah... I know... eDonkey? Who cares! :p

[snip]

Valar morghulis.

Valar dohaeris.

 
> Please, let me know if I should file this in GitHub or in /dev/null ;-)

You can file this on GitHub.  We probably could just ignore all links
that don’t begin with http[s]:// and link://, we can’t do much to any
other links anyways.

Done, issue #1695
 

(you don’t have to ask, just file on github, we would just close it as
wontfix if we didn’t care)


Noted :)
 

--
Mariano
 
Reply all
Reply to author
Forward
0 new messages