firecat53 / urlscan

Mutt and terminal url selector (similar to urlview)
GNU General Public License v2.0
211 stars 36 forks source link

& being escaped to \& 404s URLs #107

Closed fireglow closed 2 years ago

fireglow commented 3 years ago

Commit 136c4ce5bdabe0c86aa51308f14b88704bea398f introduced escaping &, but it breaks URLs for me: As an example, the URL in the message is https://lesdisquesentreprise.us10.list-manage.com/about?u=0000000000000000000000000&id=0000000000&e=0000000000&c=0000000000, but Firefox opens the URL https://lesdisquesentreprise.us10.list-manage.com/about?u=0000000000000000000000000\&id=0000000000\&e=0000000000\&c=0000000000 which the server cannot find. When undoing the replacement in urlchoose.py#L666, the URLs appearing in Firefox are verbatim the ones from the mail. Can anybody else confirm this?

firecat53 commented 3 years ago

Well, darn it. Guess I'll have to look at this again. Why can't everything respond the same way!! Thanks for the post.

firecat53 commented 2 years ago

Can you try using the xdg-open mode (cycle l in the TUI) and see if that opens the urls correctly? I'm struggling here. I've got email urls that refuse to open correctly without that commit.

Are you opening urlscan with any particular options? Are you using it from Mutt? Which terminal? Is it possible to sanitize and send me a copy of an email that isn't working correctly with this commit (email me a .tar file is best to preserve the encoding and formatting)? I'm trying to figure out what's different about either your system or your emails from mine.

Thanks!

fireglow commented 2 years ago

I'm running urlscan from mutt, via macro pager \CV <pipe-entry>'urlscan'<enter> 'Follow links with urlscan' in the kitty terminal emulator. As a test, I'm using just a simple ampersand.php:

<?php
echo $_GET['a'];
echo "\xA";
echo $_GET['b'];

And call it as https://example.com/ampersand.php?a=one&b=two which should just display "one two" in the browser.

When mailing https://example.com/ampersand.php?a=one&b=two to myself as a plaintext e-mail, and open it with

The mail is just a plain text email (Content-Type: text/plain; charset=us-ascii; format=flowed).

$ file Ampersand.eml
Ampersand.eml: SMTP mail, ASCII text, with CRLF line terminators
firecat53 commented 2 years ago

Aha! Finally figured it out. I was using a small wrapper script browser.sh to launch my web browser. Apparently that was affecting the backslash characters being sent to the browser. I'll revert that commit now, and we all should be good!