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:
parent
17a683186d
commit
b9d82167de
2 changed files with 8 additions and 6 deletions
|
|
@ -65,10 +65,11 @@ function handleFile(file) {
|
|||
updateSearchBar();
|
||||
|
||||
if (defaultTo) {
|
||||
const selector = defaultConverter
|
||||
? `.target[data-value="${defaultTo},${defaultConverter}"]`
|
||||
: `.target[data-target="${defaultTo}"]`;
|
||||
const targetBtn = document.querySelector(selector);
|
||||
const targetBtn = Array.from(document.querySelectorAll(".target")).find((t) =>
|
||||
defaultConverter
|
||||
? t.dataset.target === defaultTo && t.dataset.converter === defaultConverter
|
||||
: t.dataset.target === defaultTo,
|
||||
);
|
||||
if (targetBtn) {
|
||||
const convertToEl = document.querySelector("select[name='convert_to']");
|
||||
const convertToInputEl = document.querySelector("input[name='convert_to_search']");
|
||||
|
|
|
|||
|
|
@ -710,8 +710,9 @@ export async function convert(
|
|||
}
|
||||
|
||||
if (convertTo === "wav-3cx") {
|
||||
// 3CX telephony preset: mono, 8 kHz, 16-bit PCM
|
||||
extraArgs.push("-ac", "1", "-ar", "8000", "-sample_fmt", "s16");
|
||||
// 3CX telephony preset: mono, 8 kHz, 16-bit PCM (pcm_s16le is explicit to
|
||||
// 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue