replaced standard str.split() with shlex.split()

This commit is contained in:
Justin 2026-01-09 23:38:32 -05:00
parent a9a433bc5b
commit e8d949db86
2 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,7 @@
# core/models.py
from shlex import split as shlex_split
from django.conf import settings
from django.db import models
from django.utils.text import slugify
@ -133,7 +136,7 @@ class StreamProfile(models.Model):
# Split the command and iterate through each part to apply replacements
cmd = [self.command] + [
self._replace_in_part(part, replacements)
for part in self.parameters.split()
for part in shlex_split(self.parameters) # use shlex to handle quoted strings
]
return cmd

View file

@ -1,5 +1,6 @@
# core/views.py
import os
from shlex import split as shlex_split
import sys
import subprocess
import logging
@ -144,7 +145,7 @@ def stream_view(request, channel_uuid):
logger.debug("Formatted parameters: %s", parameters)
# Build the final command.
cmd = [stream_profile.command] + parameters.split()
cmd = [stream_profile.command] + shlex_split(parameters)
logger.debug("Executing command: %s", cmd)
try: