tanweipeng commented on issue #45395:
URL: https://github.com/apache/airflow/issues/45395#issuecomment-2635656147
We can use regex to solve it actually
```python
log_url = get_log_url(log_url=task_instance.log_url)
def get_log_url(log_url: str):
"""
Remove the base_date parameter from the log URL.
Args:
log_url (str): The log URL.
Returns:
str: The log URL without the base_date parameter.
"""
# Regex pattern to match 'base_date' and its value
updated_url = re.sub(r'(&?base_date=[^&]*)', '', log_url)
# Ensure no trailing '?' or '&' if the last param was removed
updated_url = re.sub(r'[?&]$', '', updated_url)
return updated_url
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]