mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-23 10:49:48 +00:00
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. |
||
---|---|---|
BUGFIXING | ||
contrib | ||
doc | ||
EXPERIMENTAL | ||
lisp | ||
ORGWEBPAGE | ||
UTILITIES | ||
xemacs | ||
.dir-settings.el | ||
.gitignore | ||
ChangeLog | ||
Makefile | ||
README | ||
README_DIST | ||
README_GIT | ||
request-assign-future.txt |
This is the Emacs Org project, an emacs subsystem for organizing your life The homepage of Org is at http://orgmode.org This distribution contains: README This file. README_DIST The README file for the distribution (zip and tar files) README_GIT Information about the git repository and how to contribute to Org-mode development. lisp/ Directory with all the Emacs Lisp files that make up Org. doc/ The documentation files. org.texi is the source of the documentation, org.html and org.pdf are formatted versions of it. xemacs/ The xemacs directory contains special code for XEmacs users, in particular a port of the GNU Emacs outline.el to XEmacs. Org-mode does not work under XEmacs without this file installed. It did until version 4.37, but no longer. contrib/ A directory with third-party additions for Org. Some really cool stuff is in there. ORGWEBPAGE/ Directory with the source files for the orgmode.org web page. ChangeLog The standard ChangeLog file. Makefile The makefile to compile and install Org, and also for maintenance tasks. request-assign-future.txt The form that contributors have to sign and get processed with the FSF before contributed changes can be integrated into the Org core. All files in this distribution except the CONTRIB directory have copyright assigned to the FSF. EXPERIMENTAL Experimental code, not necessarily FSF copyright.