Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] URL generation bug, plus WORKAROUND #113

Closed
code-consensus opened this issue Sep 4, 2024 · 3 comments
Closed

[BUG] URL generation bug, plus WORKAROUND #113

code-consensus opened this issue Sep 4, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@code-consensus
Copy link

code-consensus commented Sep 4, 2024

  • WhatsApp version: any
  • OS: Android
  • Platform: any
  • Branch and version: 0.10.0

Describe the bug
The program makes URLs clickable as per #69 . However, there is a bug of sorts involving messages that involve new-lines inside the message, where the link includes text and <br> elements.

To Reproduce
Steps to reproduce the behavior:

  1. With a message like:
    "https://example.com/webpage.html
    Hey check out this link"

  2. the generated HTML will look like:
    <a href="https://example.com/webpage.html<br>Hey" target="_blank">

  3. The same if there are two-new lines, you would get html like <a href="https://example.com/webpage.html<br><br>Hey">

Workaround
The issue is caused by the <br> insertions in the if "\r\n" in msg: and if "\n" in msg: sections in android_handler.py (line 446 and 461).

If you comment out those code segments to NOT add <br>, then the URLs are handled correctly (e.g. <a href="https://example.com/webpage.html">). However, that is at the expense of not creating a new line.

There must be some incompatibility with the addition of the <br> elements to the message and the subsequent "urlification" of the message in create_html() (the urlize() function in whatsapp.html?)

@KnugiHK KnugiHK self-assigned this Sep 7, 2024
@KnugiHK KnugiHK added the bug Something isn't working label Sep 7, 2024
@KnugiHK
Copy link
Owner

KnugiHK commented Sep 7, 2024

The issue should be resolved in commit f35bf24 by adding a space before the <br> tag, although it is essentially an alteration to the message.

To (if) any forensic investigators: please use the god damn paid tools like EnCase and FTK or whatever.

@code-consensus
Copy link
Author

I tested this myself, and seems to work perfectly now. As for the message being slightly "altered", that is a small price to pay to have the message show up correctly!

The issue should be resolved in commit f35bf24 by adding a space before the <br> tag, although it is essentially an alteration to the message.

To (if) any forensic investigators: please use the god damn paid tools like EnCase and FTK or whatever.

@KnugiHK KnugiHK added the pending for release Feature or bug fix to be released label Sep 9, 2024
@KnugiHK KnugiHK removed the pending for release Feature or bug fix to be released label Oct 24, 2024
@KnugiHK
Copy link
Owner

KnugiHK commented Oct 24, 2024

Released in 0.10.5.

@KnugiHK KnugiHK closed this as completed Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants