File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -109,15 +109,24 @@ def is_bot_mentioned(message_text: str) -> bool:
109109
110110def clean_url (message_text : str ) -> str :
111111 """
112- Cleans the URL from the message text by removing unwanted characters.
112+ Cleans the URL from the message text by removing unwanted characters and usernames .
113113
114114 Args:
115115 message_text (str): The text of the message containing the URL.
116116
117117 Returns:
118118 str: The cleaned URL.
119119 """
120- return message_text .replace ("**" , "" ) if message_text .startswith ("**" ) else message_text
120+ # Remove markdown formatting
121+ url = message_text .replace ("**" , "" )
122+
123+ # Split by space and take the first part (the URL)
124+ url = url .split ()[0 ]
125+
126+ # Remove any @username from the end of the URL
127+ url = url .split ('@' )[0 ]
128+
129+ return url
121130
122131
123132def is_large_file (file_path : str , max_size_mb : int = 50 ) -> bool :
You can’t perform that action at this time.
0 commit comments