Skip to content

Commit

Permalink
Cater for empty string path & parentFolderID
Browse files Browse the repository at this point in the history
  • Loading branch information
JanSpies82 committed Jul 12, 2023
1 parent ed46555 commit 4a4bc66
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions backend/src/file_manager/file_manager.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ export class FileManagerController {
if (
!markdownFileDTO.UserID ||
!markdownFileDTO.MarkdownID ||
!markdownFileDTO.ParentFolderID ||
!markdownFileDTO.Path
(!markdownFileDTO.ParentFolderID &&
markdownFileDTO.ParentFolderID !== '') ||
(!markdownFileDTO.Path &&
markdownFileDTO.Path !== '')
)
throw new HttpException(
'Invalid request data',
Expand Down Expand Up @@ -152,7 +154,8 @@ export class FileManagerController {
if (
!markdownFileDTO.UserID ||
!markdownFileDTO.MarkdownID ||
!markdownFileDTO.Content
(!markdownFileDTO.Content &&
markdownFileDTO.Content !== '')
)
throw new HttpException(
'Invalid request data',
Expand Down Expand Up @@ -235,7 +238,7 @@ export class FileManagerController {
if (
!folderDTO.UserID ||
!folderDTO.FolderName ||
!folderDTO.Path
(!folderDTO.Path && folderDTO.Path !== '')
)
throw new HttpException(
'Invalid request data',
Expand Down Expand Up @@ -317,8 +320,9 @@ export class FileManagerController {
if (
!folderDTO.UserID ||
!folderDTO.FolderID ||
!folderDTO.ParentFolderID ||
!folderDTO.Path
(!folderDTO.ParentFolderID &&
folderDTO.ParentFolderID !== '') ||
(!folderDTO.Path && folderDTO.Path !== '')
)
throw new HttpException(
'Invalid request data',
Expand Down Expand Up @@ -374,8 +378,10 @@ export class FileManagerController {
!importDTO.UserID ||
!importDTO.Type ||
!importDTO.Content ||
!importDTO.ParentFolderID ||
!importDTO.Path ||
(!importDTO.ParentFolderID &&
importDTO.ParentFolderID !== '') ||
(!importDTO.Path &&
importDTO.Path !== '') ||
!importDTO.Name
)
throw new HttpException(
Expand Down

0 comments on commit 4a4bc66

Please sign in to comment.