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

Broken message.html_text property #1259

Closed
2 tasks done
Forden opened this issue Aug 11, 2023 · 1 comment · Fixed by #1263
Closed
2 tasks done

Broken message.html_text property #1259

Forden opened this issue Aug 11, 2023 · 1 comment · Fixed by #1263
Labels
2.x Issue or PR for legacy 2.x version 3.x Issue or PR for stable 3.x version bug Something is wrong with the framework confirmed This issue is confirmed and requires action

Comments

@Forden
Copy link
Contributor

Forden commented Aug 11, 2023

Checklist

  • I am sure the error is coming from aiogram code
  • I have searched in the issue tracker for similar bug reports, including closed ones

Operating system

Ubuntu 22.04 LTS

Python version

Python 3.10.12

aiogram version

3.0.0b8

Expected behavior

Using message.html_text on text with hashtag in bold font should result in correct parsing.

Incoming text
#test
Output
<b>#test</b>

Current behavior

Instead it escapes created markup and breaks formatting.

Incoming text
#test
Output
&lt;b&gt;#test&lt;/b&gt;

Steps to reproduce

  1. Send message with hashtag inside any formatting (bold, italic, etc.)
  2. Call message.html_text on received message

Code example

import asyncio

from aiogram import Bot, Dispatcher, types

async def demo(msg: types.Message) -> None:
   await msg.reply(msg.html_text, parse_mode='HTML')


async def main() -> None:
   dp = Dispatcher()
   dp.message.register(demo)

   bot = Bot('123:ABC')
   await dp.start_polling(bot)

if __name__ == "__main__":
    try:
        asyncio.run(main())
    except (KeyboardInterrupt, SystemExit):
        logging.info("Bot stopped!")

Logs

No response

Additional information

No response

@Forden Forden added the bug Something is wrong with the framework label Aug 11, 2023
@ekeew
Copy link
Contributor

ekeew commented Aug 11, 2023

why not aiogram==3.0.0rc1 ?

@JrooTJunior JrooTJunior added 3.x Issue or PR for stable 3.x version 2.x Issue or PR for legacy 2.x version confirmed This issue is confirmed and requires action labels Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issue or PR for legacy 2.x version 3.x Issue or PR for stable 3.x version bug Something is wrong with the framework confirmed This issue is confirmed and requires action
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants