mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-03-22 08:05:48 +05:30
fix: shell escaping of yt-dlp args on flatpak
This commit is contained in:
@@ -198,7 +198,7 @@ export default function useDownloader() {
|
|||||||
|
|
||||||
const isFlatpak = await invoke<boolean>('is_flatpak');
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
const command = isFlatpak
|
const command = isFlatpak
|
||||||
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => arg.includes(' ') ? `"${arg}"` : arg).join(' ')}`])
|
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
|
||||||
: Command.sidecar('binaries/yt-dlp', args);
|
: Command.sidecar('binaries/yt-dlp', args);
|
||||||
|
|
||||||
let jsonOutput = '';
|
let jsonOutput = '';
|
||||||
@@ -562,7 +562,7 @@ export default function useDownloader() {
|
|||||||
console.log('Starting download with args:', args);
|
console.log('Starting download with args:', args);
|
||||||
const isFlatpak = await invoke<boolean>('is_flatpak');
|
const isFlatpak = await invoke<boolean>('is_flatpak');
|
||||||
const command = isFlatpak
|
const command = isFlatpak
|
||||||
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => arg.includes(' ') ? `"${arg}"` : arg).join(' ')}`])
|
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
|
||||||
: Command.sidecar('binaries/yt-dlp', args);
|
: Command.sidecar('binaries/yt-dlp', args);
|
||||||
|
|
||||||
command.on('close', async (data) => {
|
command.on('close', async (data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user