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

Port could not be cast to integer value #362

Open
lkoniecki opened this issue Jun 11, 2024 · 0 comments
Open

Port could not be cast to integer value #362

lkoniecki opened this issue Jun 11, 2024 · 0 comments

Comments

@lkoniecki
Copy link

Parsing the url, if the camera password contains special characters does not work. Looks like the logic of getting the port is wrong.

Exception in the HA log:

2024-06-11 16:25:03.639 ERROR (stream_worker) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 516, in stream_worker
    container = av.open(source, options=pyav_options, timeout=SOURCE_TIMEOUT)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "av/container/core.pyx", line 398, in av.container.core.open
  File "av/container/core.pyx", line 270, in av.container.core.Container.__cinit__
  File "av/container/core.pyx", line 290, in av.container.core.Container.err_check
  File "av/error.pyx", line 336, in av.error.err_check
av.error.ValueError: [Errno 22] Invalid argument: 'rtsp:https://user:pass@ip:554/cam/realmonitor?channel=3&subtype=0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 191, in __new__
    port = val.port
           ^^^^^^^^
  File "/usr/local/lib/python3.12/urllib/parse.py", line 182, in port
    raise ValueError(f"Port could not be cast to integer value as {port!r}")
ValueError: Port could not be cast to integer value as 'pass'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/homeassistant/homeassistant/components/stream/__init__.py", line 438, in _run_worker
    stream_worker(
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 520, in stream_worker
    f" {redact_credentials(str(source))}"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/stream/__init__.py", line 100, in redact_credentials
    yurl = URL(url)
           ^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 193, in __new__
    raise ValueError(
ValueError: Invalid URL: port can't be converted to integer

See:

Port could not be cast to integer value as 'pass'

Instead of getting the 554 port, it got password value from the URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant