mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-20 03:31:13 +10:00
feat: partial user platform support + statusMessage -> message
This commit is contained in:
@ -5,7 +5,7 @@ import sanitize from "sanitize-filename";
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const unsafeId = getRouterParam(h3, "id");
|
||||
if (!unsafeId)
|
||||
throw createError({ statusCode: 400, statusMessage: "Invalid ID" });
|
||||
throw createError({ statusCode: 400, message: "Invalid ID" });
|
||||
|
||||
const userId = await aclManager.getUserIdACL(h3, ["object:delete"]);
|
||||
|
||||
|
||||
@ -5,14 +5,14 @@ import sanitize from "sanitize-filename";
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const unsafeId = getRouterParam(h3, "id");
|
||||
if (!unsafeId)
|
||||
throw createError({ statusCode: 400, statusMessage: "Invalid ID" });
|
||||
throw createError({ statusCode: 400, message: "Invalid ID" });
|
||||
|
||||
const userId = await aclManager.getUserIdACL(h3, ["object:read"]);
|
||||
|
||||
const id = sanitize(unsafeId);
|
||||
const object = await objectHandler.fetchWithPermissions(id, userId);
|
||||
if (!object)
|
||||
throw createError({ statusCode: 404, statusMessage: "Object not found" });
|
||||
throw createError({ statusCode: 404, message: "Object not found" });
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
|
||||
const etagRequestValue = h3.headers.get("If-None-Match");
|
||||
|
||||
@ -6,14 +6,14 @@ import sanitize from "sanitize-filename";
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const unsafeId = getRouterParam(h3, "id");
|
||||
if (!unsafeId)
|
||||
throw createError({ statusCode: 400, statusMessage: "Invalid ID" });
|
||||
throw createError({ statusCode: 400, message: "Invalid ID" });
|
||||
|
||||
const userId = await aclManager.getUserIdACL(h3, ["object:read"]);
|
||||
|
||||
const id = sanitize(unsafeId);
|
||||
const object = await objectHandler.fetchWithPermissions(id, userId);
|
||||
if (!object)
|
||||
throw createError({ statusCode: 404, statusMessage: "Object not found" });
|
||||
throw createError({ statusCode: 404, message: "Object not found" });
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
|
||||
const etagRequestValue = h3.headers.get("If-None-Match");
|
||||
|
||||
@ -5,13 +5,13 @@ import sanitize from "sanitize-filename";
|
||||
export default defineEventHandler(async (h3) => {
|
||||
const unsafeId = getRouterParam(h3, "id");
|
||||
if (!unsafeId)
|
||||
throw createError({ statusCode: 400, statusMessage: "Invalid ID" });
|
||||
throw createError({ statusCode: 400, message: "Invalid ID" });
|
||||
|
||||
const body = await readRawBody(h3, "binary");
|
||||
if (!body)
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "Invalid upload",
|
||||
message: "Invalid upload",
|
||||
});
|
||||
|
||||
const userId = await aclManager.getUserIdACL(h3, ["object:update"]);
|
||||
|
||||
Reference in New Issue
Block a user