Skip to content

Commit 768fc94

Browse files
committed
fix(uploads): drop vestigial size field from register contract
1 parent a3fc764 commit 768fc94

3 files changed

Lines changed: 1 addition & 14 deletions

File tree

apps/sim/app/api/workspaces/[id]/files/register/route.test.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const makeRequest = (body: unknown) =>
5555
const validBody = {
5656
key: VALID_KEY,
5757
name: 'video.mp4',
58-
size: 10 * 1024 * 1024,
5958
contentType: 'video/mp4',
6059
}
6160

@@ -110,16 +109,6 @@ describe('POST /api/workspaces/[id]/files/register', () => {
110109
expect(res.status).toBe(400)
111110
})
112111

113-
it('returns 400 for negative size', async () => {
114-
const res = await POST(makeRequest({ ...validBody, size: -1 }), params())
115-
expect(res.status).toBe(400)
116-
})
117-
118-
it('accepts size === 0 (empty new files)', async () => {
119-
const res = await POST(makeRequest({ ...validBody, size: 0 }), params())
120-
expect(res.status).toBe(200)
121-
})
122-
123112
it('returns 404 when storage object is missing', async () => {
124113
mockRegisterUploadedWorkspaceFile.mockRejectedValueOnce(
125114
new Error('Uploaded object not found in storage')

apps/sim/hooks/queries/workspace-files.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ const REGISTER_RETRY_DELAY_MS = 500
286286
*/
287287
async function registerWithRetry(
288288
workspaceId: string,
289-
result: { key: string; name: string; size: number; contentType: string },
289+
result: { key: string; name: string; contentType: string },
290290
signal?: AbortSignal
291291
) {
292292
let lastError: unknown
@@ -297,7 +297,6 @@ async function registerWithRetry(
297297
body: {
298298
key: result.key,
299299
name: result.name,
300-
size: result.size,
301300
contentType: result.contentType,
302301
},
303302
signal,

apps/sim/lib/api/contracts/workspace-files.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ export const workspacePresignedUploadContract = defineRouteContract({
182182
export const registerWorkspaceFileBodySchema = z.object({
183183
key: z.string().min(1, 'key is required'),
184184
name: z.string().min(1, 'name is required'),
185-
size: z.number().nonnegative('size must be a non-negative number'),
186185
contentType: z.string().min(1, 'contentType is required'),
187186
})
188187

0 commit comments

Comments
 (0)