### Apache Airflow version

2.6.3

### What happened

A task instance's [log_url](https://github.com/apache/airflow/blob/2.6.3/airflow/models/taskinstance.py#L726) does not contain the full URL defined in [base_url](https://github.com/apache/airflow/blob/2.6.3/airflow/models/taskinstance.py#L729C9-L729C69).

### What you think should happen instead

The base_url may contain paths that should be acknowledged when build the log_url. 

The log_url is built with [urljoin](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urljoin). Due to how urljoin builds URLs, any existing paths are ignored leading to a faulty URL. 

### How to reproduce

This snippet showcases how urljoin ignores existing paths when building the url.

```
>>> from urllib.parse import urljoin
>>> 
>>> 
>>> urljoin(
...     "https://my.astronomer.run/path",
...     f"log?execution_date=test"
...     f"&task_id=wow"
...     f"&dag_id=super"
...     f"&map_index=-1",
... )
'https://eochgroup.astronomer.run/log?execution_date=test&task_id=wow&dag_id=super&map_index=-1'
```

### Operating System

n/a

### Versions of Apache Airflow Providers

_No response_

### Deployment

Astronomer

### Deployment details

_No response_

### Anything else

This was introduced by #31833.

A way to fix this can be to utilize [urlsplit](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlsplit) and [urlunsplit](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlunsplit) to account for existing paths.

```
from urllib.parse import urlsplit, urlunsplit

parts = urlsplit("https://my.astronomer.run/paths")
urlunsplit((
        parts.scheme,
        parts.netloc,
        f"{parts.path}/log",
        f"execution_date=test"
        f"&task_id=wow"
        f"&dag_id=super"
        f"&map_index=-1",
        ""
    )
)
```

Here is the fix in action.

```
>>> parts = urlsplit("https://my.astronomer.run/paths")
>>> urlunsplit((
...     parts.scheme,
...     parts.netloc,
...     f"{parts.path}/log",
...     f"execution_date=test"
...     f"&task_id=wow"
...     f"&dag_id=super"
...     f"&map_index=-1",
...     ''))
'https://my.astronomer.run/paths/log?execution_date=test&task_id=wow&dag_id=super&map_index=-1'
>>>
>>> parts = urlsplit("https://my.astronomer.run/paths/test")
>>> urlunsplit((
...     parts.scheme,
...     parts.netloc,
...     f"{parts.path}/log",
...     f"execution_date=test"
...     f"&task_id=wow"
...     f"&dag_id=super"
...     f"&map_index=-1",
...     ''))
'https://my.astronomer.run/paths/test/log?execution_date=test&task_id=wow&dag_id=super&map_index=-1'
```

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

if conf.has_option("email", key):
                    path = conf.get_mandatory_value("email", key)
                    try:
                        with open(path) as f:
                            content = f.read()
                    except FileNotFoundError:
                        self.log.warning(f"Could not find email template file '{path!r}'. Using defaults...")
                    except OSError:
                        self.log.exception(f"Error while using email template '{path!r}'. Using defaults...")
                return render_template_to_string(jinja_env.from_string(content), jinja_context)
            subject = render("subject_template", default_subject)
            html_content = render("html_content_template", default_html_content)
            html_content_err = render("html_content_template", default_html_content_err)
        return subject, html_content, html_content_err
    def email_alert(self, exception, task: BaseOperator) -> None:
        """Send alert email with exception information."""
        subject, html_content, html_content_err = self.get_email_subject_content(exception, task=task)
        assert task.email
        try:
            send_email(task.email, subject, html_content)
        except Exception:
            send_email(task.email, subject, html_content_err)
    def set_duration(self) -> None:
        """Set TI duration."""
        if self.end_date and self.start_date:
            self.duration = (self.end_date - self.start_date).total_seconds()
        else:
            self.duration = None
        self.log.debug("Task Duration set to %s", self.duration)
    def _record_task_map_for_downstreams(self, task: Operator, value: Any, *, session: Session) -> None: