remove useless sanitize because we don't save to disk
This commit is contained in:
parent
6ec2f39c71
commit
57b5e59fac
1 changed files with 2 additions and 9 deletions
|
@ -1,14 +1,7 @@
|
||||||
import { json, error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from './$types';
|
||||||
import { getYouTubeMetadata, streamYouTube } from '$lib/server/ytdlp';
|
import { getYouTubeMetadata, streamYouTube } from '$lib/server/ytdlp';
|
||||||
|
|
||||||
/**
|
|
||||||
* Sanitize filename by removing unsafe characters
|
|
||||||
*/
|
|
||||||
function sanitizeFilename(name: string): string {
|
|
||||||
return name.replace(/[\/:*?"<>|]/g, '').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async ({ url }) => {
|
export const GET: RequestHandler = async ({ url }) => {
|
||||||
// Get query params
|
// Get query params
|
||||||
const link = url.searchParams.get('link');
|
const link = url.searchParams.get('link');
|
||||||
|
@ -28,7 +21,7 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||||
// Fetch metadata for filename
|
// Fetch metadata for filename
|
||||||
const metadata = await getYouTubeMetadata(link);
|
const metadata = await getYouTubeMetadata(link);
|
||||||
const { title, uploader } = metadata;
|
const { title, uploader } = metadata;
|
||||||
const safeTitle = sanitizeFilename(`${uploader} - ${title}`);
|
const safeTitle = `${uploader} - ${title}`;
|
||||||
const filename = `${safeTitle}.${format}`;
|
const filename = `${safeTitle}.${format}`;
|
||||||
|
|
||||||
console.log(filename);
|
console.log(filename);
|
||||||
|
|
Loading…
Add table
Reference in a new issue