Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: remove unnecessary testing changes

Tincd7bd4c470fc
diff --git a/apps/api/src/storage/s3.ts b/apps/api/src/storage/s3.ts
index 114dd22d9..003de43a9 100644
--- a/apps/api/src/storage/s3.ts
+++ b/apps/api/src/storage/s3.ts
@@ -1,7 +1,6 @@
import { Readable } from "node:stream";
import {
GetObjectCommand,
- HeadObjectCommand,
PutObjectCommand,
S3Client,
type S3ClientConfig,
@@ -269,18 +268,6 @@ export function assertTaskImageKeyMatchesContext(
return key.startsWith(prefix);
}
-export async function assertObjectExists(key: string) {
- const config = getStorageConfig();
- const client = getClient(config);
-
- await client.send(
- new HeadObjectCommand({
- Bucket: config.bucket,
- Key: key,
- }),
- );
-}
-
export async function getPrivateObject(key: string): Promise<AssetObject> {
const config = getStorageConfig();
const client = getClient(config);
diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.ts
index 749cc92d6..adcdaac94 100644
--- a/apps/api/src/task/index.ts
+++ b/apps/api/src/task/index.ts
@@ -14,7 +14,6 @@ import {
import { publishEvent } from "../events";
import { taskSchema } from "../schemas";
import {
- assertObjectExists,
assertTaskImageKeyMatchesContext,
createTaskImageUploadUrl,
isImageContentType,
@@ -807,8 +806,9 @@ const task = new Hono<{
throw new HTTPException(404, { message: "Task not found" });
}
+ const normalizedKey = key.trim();
if (
- !assertTaskImageKeyMatchesContext(key, {
+ !assertTaskImageKeyMatchesContext(normalizedKey, {
workspaceId: taskContext.workspaceId,
projectId: taskContext.projectId,
taskId: taskContext.taskId,
@@ -820,18 +820,10 @@ const task = new Hono<{
});
}
- try {
- await assertObjectExists(key);
- } catch {
- throw new HTTPException(404, {
- message: "Uploaded object could not be found in storage.",
- });
- }
-
const [existingAsset] = await db
.select({ id: assetTable.id })
.from(assetTable)
- .where(eq(assetTable.objectKey, key))
+ .where(eq(assetTable.objectKey, normalizedKey))
.limit(1);
const [asset] = existingAsset
@@ -858,7 +850,7 @@ const task = new Hono<{
workspaceId: taskContext.workspaceId,
projectId: taskContext.projectId,
taskId: taskContext.taskId,
- objectKey: key,
+ objectKey: normalizedKey,
filename,
mimeType: contentType,
size,