Browse Source

fix: add multer interceptor for public insert api

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
f0e245023b
  1. 3
      packages/nocodb-nest/src/modules/attachments/attachments.controller.ts
  2. 23
      packages/nocodb-nest/src/modules/public-datas/public-datas.controller.ts

3
packages/nocodb-nest/src/modules/attachments/attachments.controller.ts

@ -48,9 +48,6 @@ export class AttachmentsController {
UploadAllowedInterceptor, UploadAllowedInterceptor,
AnyFilesInterceptor({ AnyFilesInterceptor({
storage: multer.diskStorage({}), storage: multer.diskStorage({}),
// limits: {
// fieldSize: NC_ATTACHMENT_FIELD_SIZE,
// },
limits: { limits: {
fileSize: NC_ATTACHMENT_FIELD_SIZE, fileSize: NC_ATTACHMENT_FIELD_SIZE,
}, },

23
packages/nocodb-nest/src/modules/public-datas/public-datas.controller.ts

@ -1,4 +1,16 @@
import { Controller, Get, HttpCode, Param, Post, Request } from '@nestjs/common' import {
Controller,
Get,
HttpCode,
Param,
Post,
Request,
UseInterceptors,
} from '@nestjs/common';
import { AnyFilesInterceptor } from '@nestjs/platform-express';
import multer from 'multer';
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants';
import { UploadAllowedInterceptor } from '../../interceptors/is-upload-allowed/is-upload-allowed.interceptor';
import { PublicDatasService } from './public-datas.service'; import { PublicDatasService } from './public-datas.service';
@Controller() @Controller()
@ -47,6 +59,15 @@ export class PublicDatasController {
// ); // );
@Post('/api/v1/db/public/shared-view/:sharedViewUuid/rows') @Post('/api/v1/db/public/shared-view/:sharedViewUuid/rows')
@HttpCode(200) @HttpCode(200)
@UseInterceptors(
UploadAllowedInterceptor,
AnyFilesInterceptor({
storage: multer.diskStorage({}),
limits: {
fileSize: NC_ATTACHMENT_FIELD_SIZE,
},
}),
)
async dataInsert( async dataInsert(
@Request() req, @Request() req,
@Param('sharedViewUuid') sharedViewUuid: string, @Param('sharedViewUuid') sharedViewUuid: string,

Loading…
Cancel
Save