0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-24 16:32:51 +00:00
org-mode/lisp
Carsten Dominik dcf34971f6 Fix link encoding bug:
Geert Kloosterman writes:

> When an org link is created from an URL containing a hex escape
> `org-make-link-string' creates a link that ends up corrupted the moment
> it is followed (e.g. using `org-open-at-point').
>
> I've traced this back to `org-link-escape' and `org-link-unescape'.  The
> following shows how the hex code "%2B" is converted to a "+" after an
> escaping round trip:
>
>    (org-link-unescape (org-link-escape
>                        "http://some.host.com/form?&id=blah%2Bblah"))
>    ==>
>    "http://some.host.com/form?&id=blah+blah"
>
> In my case this small change ended up in a broken URL.
>
> Additionally, when the URL-escape happens to be in lower case (or
> otherwise not present in `org-link-escape-chars') we end up with an
> error:
>
>    (org-link-unescape (org-link-escape
>                        "http://some.host.com/form?&id=blah%2bblah"))
>    ==>
>    Debugger entered--Lisp error: (wrong-type-argument characterp nil)
>      char-to-string(nil)
>      ...
>
> When `org-url-encoding-use-url-hexify' is set to `t' we do get a proper
> round trip of the URL containing hex-escapes:
>
>    (setq org-url-encoding-use-url-hexify t)
>    (org-link-unescape (org-link-escape
>                        "http://some.host.com/form?&id=blah%2bblah"))
>    ==>
>    "http://some.host.com/form?&id=blah%2bblah"
>
>
> Setting `org-url-encoding-use-url-hexify' does not fix the complete
> problem however: `org-open-at-point' still did not end up with the
> proper URL.   Within `org-open-at-point' there is another call to
> `org-link-escape':
>
>    (org-link-escape path org-link-escape-chars-browser)
>
> This time a mapping table is passed in explicitly (the second argument).
> However, when `org-url-encoding-use-url-hexify' is set,a this mapping
> table isn't used, resulting (again) in a broken URL.
>
> I have attached a patch that fixes the problem: do not use url-hexify in
> `org-link-escape' and `org-link-unescape' when an explicit mapping table
> has been specified.
>
> In summary:
> - the default behaviour of `org-link-escape', with
>   `org-url-encoding-use-url-hexify' set to nil, has some issues with
>   handling URLS which contain url-encoded hex escapes
> - when a mapping table is passed to `org-link-escape' and
>   `org-link-unescape', they should probably not use url-hexify.
>   Patch attached.
2010-01-16 01:10:23 +01:00
..
ChangeLog Fix link encoding bug: 2010-01-16 01:10:23 +01:00
ChangeLog.01 Split ChangeLog file into parts. 2008-05-08 08:16:38 +02:00
org-agenda.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-archive.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-ascii.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-attach.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-bbdb.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-beamer.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-bibtex.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-clock.el Automatically clock out when switching to specified state 2010-01-15 18:21:36 +01:00
org-colview-xemacs.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-colview.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-compat.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-crypt.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-ctags.el Improve test for operating system in org-ctags.el 2010-01-15 18:07:40 +01:00
org-datetree.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-docbook.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-docview.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-exp-blocks.el Tag ditaa and dot files with hash, to avoid remaking them 2009-11-17 16:35:08 +01:00
org-exp.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-faces.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-feed.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-footnote.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-freemind.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-gnus.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-habit.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-html.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-icalendar.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-id.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-indent.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-info.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-inlinetask.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-irc.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-jsinfo.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-latex.el LaTeX export: Fix another protection bug, this time the char before a "\" 2010-01-15 08:05:22 +01:00
org-list.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-mac-message.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-macs.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-mew.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-mhe.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-mobile.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-mouse.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-plot.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-protocol.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-publish.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-remember.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-rmail.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-src.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-table.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-timer.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-vm.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-w3m.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-wl.el Release 6.34b 2010-01-14 23:06:55 +01:00
org-xoxo.el Release 6.34b 2010-01-14 23:06:55 +01:00
org.el Fix link encoding bug: 2010-01-16 01:10:23 +01:00