Remove JSON mode from download endpoint
This commit is contained in:
@ -4,7 +4,7 @@ import { error } from '@sveltejs/kit';
|
||||
import fs from 'node:fs/promises';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
export const GET: RequestHandler = async ({ params, url }) => {
|
||||
export const GET: RequestHandler = async ({ params }) => {
|
||||
try {
|
||||
const zipName = getZipName(params);
|
||||
const album = await getMetadata(zipName);
|
||||
@ -12,14 +12,6 @@ export const GET: RequestHandler = async ({ params, url }) => {
|
||||
if (!allowDownload) {
|
||||
throw error(403, 'Forbidden');
|
||||
}
|
||||
if (url.searchParams.get('type') === 'json') {
|
||||
return new Response(JSON.stringify(album), {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Disposition': 'inline'
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const content = await fs.readFile(`./zip/${zipName}`);
|
||||
return new Response(content, {
|
||||
headers: {
|
||||
@ -27,7 +19,6 @@ export const GET: RequestHandler = async ({ params, url }) => {
|
||||
'Content-Disposition': `attachment; filename="${zipName}"`
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
throw error(404, 'Not found');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user