Skip to content

Commit b9d8216

Browse files
committed
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>
1 parent 17a6831 commit b9d8216

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

public/script.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ function handleFile(file) {
6565
updateSearchBar();
6666

6767
if (defaultTo) {
68-
const selector = defaultConverter
69-
? `.target[data-value="${defaultTo},${defaultConverter}"]`
70-
: `.target[data-target="${defaultTo}"]`;
71-
const targetBtn = document.querySelector(selector);
68+
const targetBtn = Array.from(document.querySelectorAll(".target")).find((t) =>
69+
defaultConverter
70+
? t.dataset.target === defaultTo && t.dataset.converter === defaultConverter
71+
: t.dataset.target === defaultTo,
72+
);
7273
if (targetBtn) {
7374
const convertToEl = document.querySelector("select[name='convert_to']");
7475
const convertToInputEl = document.querySelector("input[name='convert_to_search']");

src/converters/ffmpeg.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,9 @@ export async function convert(
710710
}
711711

712712
if (convertTo === "wav-3cx") {
713-
// 3CX telephony preset: mono, 8 kHz, 16-bit PCM
714-
extraArgs.push("-ac", "1", "-ar", "8000", "-sample_fmt", "s16");
713+
// 3CX telephony preset: mono, 8 kHz, 16-bit PCM (pcm_s16le is explicit to
714+
// avoid FFMPEG_OUTPUT_ARGS overriding the codec and breaking 3CX playback)
715+
extraArgs.push("-ac", "1", "-ar", "8000", "-c:a", "pcm_s16le");
715716
}
716717

717718
if (convertTo.split(".").length > 1) {

0 commit comments

Comments
 (0)