mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-27 02:04:39 +10:00
fix: missing user check in screenshot api endpoint
This commit is contained in:
@@ -13,5 +13,16 @@ export default defineEventHandler(async (h3) => {
|
|||||||
statusMessage: "Missing screenshot ID",
|
statusMessage: "Missing screenshot ID",
|
||||||
});
|
});
|
||||||
|
|
||||||
return await screenshotManager.delete(screenshotId);
|
const result = await screenshotManager.get(screenshotId);
|
||||||
|
if (!result)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: "Incorrect screenshot ID",
|
||||||
|
});
|
||||||
|
else if (result.userId !== userId)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 403,
|
||||||
|
});
|
||||||
|
|
||||||
|
await screenshotManager.delete(screenshotId);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,5 +13,15 @@ export default defineEventHandler(async (h3) => {
|
|||||||
statusMessage: "Missing screenshot ID",
|
statusMessage: "Missing screenshot ID",
|
||||||
});
|
});
|
||||||
|
|
||||||
return await screenshotManager.get(screenshotId);
|
const result = await screenshotManager.get(screenshotId);
|
||||||
|
if (!result)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: "Incorrect screenshot ID",
|
||||||
|
});
|
||||||
|
else if (result.userId !== userId)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 403,
|
||||||
|
});
|
||||||
|
return result;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user