### Summary

When trying to install multiple collections from local directory using `type: subdirs` in requirements.yml, `ansible-galaxy` throws raw python unhandled exception.

Problem started occur when updated ansible to `8.0.0`. 

### Issue Type

Bug Report

### Component Name

ansible-galaxy

### Ansible Version

```console
$ ansible --version
ansible [core 2.15.0]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = None
```


### OS / Environment

Ubuntu 22.04, Debian Bullseye 

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```bash (paste below)
ansible-galaxy collection init collections.testa && ansible-galaxy collection init collections.testb \
&& echo """
collections:
  - source: ./collections
    type: subdirs
""" > requirements.yml && ansible-galaxy install -r requirements.yml
```


### Expected Results

Same as in previous versions - installation of all collections inside the directory, using directory name as namespace. 

### Actual Results

```console
ERROR! Unexpected Exception, this is probably a bug: endswith first arg must be str or a tuple of str, not bytes
to see the full traceback, use -vvv
```

```pytb
Traceback (most recent call last):
  File ".../ansible/lib/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File ".../ansible/bin/ansible-galaxy", line 715, in run
    return context.CLIARGS['func']()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../ansible/bin/ansible-galaxy", line 117, in method_wrapper
    return wrapped_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../ansible/bin/ansible-galaxy", line 1369, in execute_install
    self._execute_install_collection(
  File ".../ansible/bin/ansible-galaxy", line 1409, in _execute_install_collection
    install_collections(
  File ".../ansible/lib/ansible/galaxy/collection/__init__.py", line 681, in install_collections
    unsatisfied_requirements = set(
                               ^^^^
  File ".../ansible/lib/ansible/galaxy/collection/__init__.py", line 684, in <genexpr>
    Requirement.from_dir_path(sub_coll, artifacts_manager)
  File ".../ansible/lib/ansible/galaxy/dependency_resolution/dataclasses.py", line 221, in from_dir_path
    if dir_path.endswith(to_bytes(os.path.sep)):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: endswith first arg must be str or a tuple of str, not bytes
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
shutil.copy(to_native(b_src_path), to_native(b_dest_path))
            display.display(
                "Collection '{coll!s}' was downloaded successfully".
                format(coll=concrete_coll_pin),
            )
            requirements.append({
                
                
                
                
                
                
                'name': to_native(os.path.basename(b_dest_path)),
                'version': concrete_coll_pin.ver,
            })
        requirements_path = os.path.join(output_path, 'requirements.yml')
        b_requirements_path = to_bytes(
            requirements_path, errors='surrogate_or_strict',
        )
        display.display(
            u'Writing requirements.yml file of downloaded collections '
            "to '{path!s}'".format(path=to_text(requirements_path)),
        )
        yaml_bytes = to_bytes(
            yaml_dump({'collections': requirements}),
            errors='surrogate_or_strict',
        )
        with open(b_requirements_path, mode='wb') as req_fd:
            req_fd.write(yaml_bytes)
def publish_collection(collection_path, api, wait, timeout):