Using str to check if video file is relative to channel directory.

This commit is contained in:
Roland 2022-01-14 16:06:23 -07:00
parent b5d5515174
commit 8b9d44df5c
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

View file

@ -435,8 +435,8 @@ def upsert_video(session: Session, video_path: pathlib.Path, channel: Channel =
video.poster_path = poster_path
video.video_path = video_path
if channel and not video_path.is_relative_to(channel.directory.path):
raise ValueError(f'Video path is not within its channel {video_path=} {channel.directory=}')
if channel and not str(video_path).startswith(str(channel.directory.path)):
raise ValueError(f'Video path is not within its channel {video_path=} not in {channel.directory=}')
video.channel = channel
video.idempotency = idempotency