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

url returned by href parameter in LinkClicked is decoding when it should not (Markdown Widget) #5426

Open
jspv opened this issue Dec 22, 2024 · 0 comments

Comments

@jspv
Copy link
Contributor

jspv commented Dec 22, 2024

Noted that authenticated links were breaking with signature failures, and tracing it down found that the link being returned is not the same as the link being clicked. example:

#!/usr/bin/python3

from textual.app import App, ComposeResult
from textual.widgets import Markdown

text = """
Here is an image of a dog created with DALL-E 3:

![Dog](https://some.site.us/tool?st=2024-12-22T18%3A07%3A22Z&se=2024-12-22T20%3A07%3A22Z)
"""

log_file = "linktest.txt"


class MyApp(App):
    def compose(self) -> ComposeResult:
        self.md = Markdown(markdown=text)
        yield self.md

    def on_markdown_link_clicked(self, message: Markdown.LinkClicked):
        with open(log_file, "w") as f:
            f.write(f"Original message={text}\n")
            f.write(f"Link received={message.href}\n")


if __name__ == "__main__":
    app = MyApp()
    app.run()

Output:

Original message=
Here is an image of a dog created with DALL-E 3:

![Dog](https://some.site.us/tool?st=2024-12-22T18%3A07%3A22Z&se=2024-12-22T20%3A07%3A22Z)

Link received=https://some.site.us/tool?st=2024-12-22T18:07:22Z&se=2024-12-22T20:07:22Z

Note the decoding. I would expect that the link received would be identical to the link in the Markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant