* Links with description and '%3f' in URL fail
@ 2010-03-04 16:06 Sebastien Delafond
2010-03-04 20:51 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Delafond @ 2010-03-04 16:06 UTC (permalink / raw
To: emacs-orgmode
Quoting from debian bug report #572404[0]:
This error is quite esoteric. Creating a link with a '%3f' escape
sequence in its URL (at least HTTP ones) makes it fail to be edited
with C-c C-l and exported with the error:
org-link-unescape: Wrong type argument: characterp, nil
But only if the link has a description. Other escape sequences like
'%3e' or '%40' or even the literal '?' corresponding to character 0x3f
don't trigger the error. For instance:
- http://www.example.com/x%3fx doesn't trigger the error
- [[http://www.example.com/x%3fx][test]] triggers the error
- [[http://www.example.com/x%3ex][test]] doesn't trigger the error
- [[http://www.example.com/x?x][test]] doesn't trigger the error
Even more strange, while '%3f' reveals the error, '%3F' does not. I
guess the ``org-link-unescape`` function has some serious problems
with the handling of '?': when using '%3F' in an HTTP URL, it is
unescaped when exported to HTML, resulting most of the time in invalid
URLs, since the '?' character separates the path from query arguments.
For instance, in "http://x.org/what%3F" the '%3F' should be left as is
instead of being exported as "http://x.org/what?". In
"http://x.org/query?foo=bar", the '?' should also be left as is.
Here it's better to trust the user and leave URLs untouched than
trying to be too smart.
It at least sounds a like strange that it'd behave diffrently depending
on whether or not there is a description alongside the link...
Cheers,
--Seb
[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572404
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Links with description and '%3f' in URL fail
2010-03-04 16:06 Links with description and '%3f' in URL fail Sebastien Delafond
@ 2010-03-04 20:51 ` Carsten Dominik
2010-03-05 10:00 ` Sebastien Delafond
0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2010-03-04 20:51 UTC (permalink / raw
To: Sebastien Delafond; +Cc: emacs-orgmode
Hi Sebastian,
could you please try if the following patch does solve this issue?
Thanks.
- Carsten
diff --git a/lisp/org.el b/lisp/org.el
index 85b74fa..59d2acf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7950,12 +7950,14 @@ This is the list that is used before handing
over to the browser.")
(url-unhex-string text)
(setq table (or table org-link-escape-chars))
(when text
- (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
+ (let ((case-fold-search t)
+ (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x))))
table "\\|")))
(while (string-match re text)
(setq text
(replace-match
- (char-to-string (car (rassoc (match-string 0 text) table)))
+ (char-to-string (car (rassoc (upcase (match-string 0 text))
+ table)))
t t text)))
text))))
On Mar 4, 2010, at 5:06 PM, Sebastien Delafond wrote:
> Quoting from debian bug report #572404[0]:
>
> This error is quite esoteric. Creating a link with a '%3f' escape
> sequence in its URL (at least HTTP ones) makes it fail to be edited
> with C-c C-l and exported with the error:
>
> org-link-unescape: Wrong type argument: characterp, nil
>
> But only if the link has a description. Other escape sequences like
> '%3e' or '%40' or even the literal '?' corresponding to character
> 0x3f
> don't trigger the error. For instance:
>
> - http://www.example.com/x%3fx doesn't trigger the error
> - [[http://www.example.com/x%3fx][test]] triggers the error
> - [[http://www.example.com/x%3ex][test]] doesn't trigger the error
> - [[http://www.example.com/x?x][test]] doesn't trigger the error
>
> Even more strange, while '%3f' reveals the error, '%3F' does not. I
> guess the ``org-link-unescape`` function has some serious problems
> with the handling of '?': when using '%3F' in an HTTP URL, it is
> unescaped when exported to HTML, resulting most of the time in
> invalid
> URLs, since the '?' character separates the path from query
> arguments.
>
> For instance, in "http://x.org/what%3F" the '%3F' should be left as
> is
> instead of being exported as "http://x.org/what?". In
> "http://x.org/query?foo=bar", the '?' should also be left as is.
>
> Here it's better to trust the user and leave URLs untouched than
> trying to be too smart.
>
> It at least sounds a like strange that it'd behave diffrently
> depending
> on whether or not there is a description alongside the link...
>
> Cheers,
>
> --Seb
>
> [0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572404
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Links with description and '%3f' in URL fail
2010-03-04 20:51 ` Carsten Dominik
@ 2010-03-05 10:00 ` Sebastien Delafond
2010-03-05 12:37 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Delafond @ 2010-03-05 10:00 UTC (permalink / raw
To: emacs-orgmode
On 2010-03-04, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Hi Sebastian,
>
> could you please try if the following patch does solve this issue?
>
> Thanks.
>
> - Carsten
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 85b74fa..59d2acf 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -7950,12 +7950,14 @@ This is the list that is used before handing
> over to the browser.")
> (url-unhex-string text)
> (setq table (or table org-link-escape-chars))
> (when text
> - (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
> + (let ((case-fold-search t)
> + (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x))))
> table "\\|")))
> (while (string-match re text)
> (setq text
> (replace-match
> - (char-to-string (car (rassoc (match-string 0 text) table)))
> + (char-to-string (car (rassoc (upcase (match-string 0 text))
> + table)))
> t t text)))
> text))))
yes, it does just fine; thank you very much for you time !
Cheers,
--Seb
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: Links with description and '%3f' in URL fail
2010-03-05 10:00 ` Sebastien Delafond
@ 2010-03-05 12:37 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-03-05 12:37 UTC (permalink / raw
To: Sebastien Delafond; +Cc: emacs-orgmode
OK, I applied the patch to the git master.
On Mar 5, 2010, at 11:00 AM, Sebastien Delafond wrote:
> On 2010-03-04, Carsten Dominik <carsten.dominik@gmail.com> wrote:
>> Hi Sebastian,
>>
>> could you please try if the following patch does solve this issue?
>>
>> Thanks.
>>
>> - Carsten
>>
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 85b74fa..59d2acf 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -7950,12 +7950,14 @@ This is the list that is used before handing
>> over to the browser.")
>> (url-unhex-string text)
>> (setq table (or table org-link-escape-chars))
>> (when text
>> - (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
>> + (let ((case-fold-search t)
>> + (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x))))
>> table "\\|")))
>> (while (string-match re text)
>> (setq text
>> (replace-match
>> - (char-to-string (car (rassoc (match-string 0 text) table)))
>> + (char-to-string (car (rassoc (upcase (match-string 0 text))
>> + table)))
>> t t text)))
>> text))))
>
> yes, it does just fine; thank you very much for you time !
>
> Cheers,
>
> --Seb
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-05 12:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04 16:06 Links with description and '%3f' in URL fail Sebastien Delafond
2010-03-04 20:51 ` Carsten Dominik
2010-03-05 10:00 ` Sebastien Delafond
2010-03-05 12:37 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.