-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Monday, April 1 at 07:30 PM, quoth Luis Mochan:
> I tried now your fix, and it didn't work for me; my browser doesn't
> find the resulting pages when the url has ampersands that are
> converted to %26 (probably because the % itself is further encoded
> as %25 before been sent to the server by the browser (?))
What?!? That's *really* strange. Is extract_url.pl double-encoding the
percent, or is some script in between doing that?
> I don't know much about shell programming, but I found that
> /etc/urlhandler/url_handler.sh is a shell script that obtains its
> url doing '$url=$1'.
Ahh, indeed, that could cause a problem. Variables are substituted
simply, in an "as if typed" manner. Take this simple example:
# foo=bar
# echo $foo
bar
Fairly straightforward. BUT, if we use an ampersand:
# foo=bar&baz
[1] 20113
baz: command not found
[1]+ Done foo=bar
# echo $foo
#
You see, the ampersand did two things there: first, it created a
sub-shell to execute 'foo=bar' in the background, and then attempted
to execute 'baz' as if it were a command. What that shell script
*should* have done is quote the argument, like this:
url="$1"
To return to my example:
# foo="bar&baz"
# echo $foo
bar&baz
> I don't understand why echo by itself yields the correct result
> (above) while echo through a bash script yields the truncated
> result.
It's because of the incorrectly quoted variable assignment, which is
cutting off the URL at the ampersand.
~Kyle
- --
Always forgive your enemies; nothing annoys them so much.
-- Oscar Wilde
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iQIcBAEBCAAGBQJRWvELAAoJECuveozR/AWeW+QP/0a/uhmbPio/web5Fu4zbcS8
VFj5/FJR1ql/0Wfrs9eL/JPb06cyvGm8M2xrLq/eVwuvMc4gPzIKwtqEwutanVh8
1JvUWCYFlQxqwYW5H4EKT9y6zCkqgJenisXdD0T9EbWO13fleDnlBXki5o63WPyb
GzPA11TuHOXIq6cxcMWfx6tt8DgtkIj36Jk5bpcS0/mE1s+nthsTCGILhM3PVU5k
ejLlFUFY1L7YUePqYpqhyCA/akMOvpcbMPdxw701WWMcr1UGi9Netu/otpZTPrz0
XiS2XvdzggCMwIRBJU5buhT9HpOOjmH2qPXIr0WDW3S6MKquAvm8agHvtkgXEqNI
0vGZ/KqKoNUBUJUgjOaFW9zZFvUHrYhzfsdFHjspglVbPMreqw3DggZErUa0Eifm
q1j0dYsOZ/xmmp3iFO38iYfc5NBTJcXuBZIDS+scRJw4ZFhfedEBJcskEX7Jcxnu
l9bwwa+nIxEidUou87EcKslzDB/lux0ihdsZzSRQNmpV82FW59kCqkcY0brLJoeh
GgJgtHk4tFe2Vw4cN4uAw8EpvxnmAP/lDCmTwUVcdKbvy+p8f49vvElpUC+eWnq/
vQuynegYN/GQyj0CQJxU25m35UhKG7X+XzYOKojmnxG9E9O94YANZ5NBxRUuyR8K
ntttDNCaEt6oARXNCp2H
=MZB4
-----END PGP SIGNATURE-----