fix: address Copilot review comments on PR #568

- script.js: replace unsafe CSS selector interpolation from URL params
  with dataset comparison via Array.from().find() to avoid DOMException
  on values containing quotes, brackets or other special characters
- ffmpeg.ts: add explicit -c:a pcm_s16le to wav-3cx preset so the PCM
  codec is always set regardless of FFMPEG_OUTPUT_ARGS

Signed-off-by: Radhakrishnan Pachyappan <gingeekrishna@gmail.com>
This commit is contained in:
Radhakrishnan Pachyappan 2026-06-22 00:22:38 +05:30
parent 17a683186d
commit b9d82167de
2 changed files with 8 additions and 6 deletions

View file

@ -65,10 +65,11 @@ function handleFile(file) {
updateSearchBar(); updateSearchBar();
if (defaultTo) { if (defaultTo) {
const selector = defaultConverter const targetBtn = Array.from(document.querySelectorAll(".target")).find((t) =>
? `.target[data-value="${defaultTo},${defaultConverter}"]` defaultConverter
: `.target[data-target="${defaultTo}"]`; ? t.dataset.target === defaultTo && t.dataset.converter === defaultConverter
const targetBtn = document.querySelector(selector); : t.dataset.target === defaultTo,
);
if (targetBtn) { if (targetBtn) {
const convertToEl = document.querySelector("select[name='convert_to']"); const convertToEl = document.querySelector("select[name='convert_to']");
const convertToInputEl = document.querySelector("input[name='convert_to_search']"); const convertToInputEl = document.querySelector("input[name='convert_to_search']");

View file

@ -710,8 +710,9 @@ export async function convert(
} }
if (convertTo === "wav-3cx") { if (convertTo === "wav-3cx") {
// 3CX telephony preset: mono, 8 kHz, 16-bit PCM // 3CX telephony preset: mono, 8 kHz, 16-bit PCM (pcm_s16le is explicit to
extraArgs.push("-ac", "1", "-ar", "8000", "-sample_fmt", "s16"); // avoid FFMPEG_OUTPUT_ARGS overriding the codec and breaking 3CX playback)
extraArgs.push("-ac", "1", "-ar", "8000", "-c:a", "pcm_s16le");
} }
if (convertTo.split(".").length > 1) { if (convertTo.split(".").length > 1) {