Skip to content

Commit

Permalink
Fix potential type bug + editorconfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
digisomni committed Sep 12, 2024
1 parent 9b946ac commit 8d7336b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
end_of_line = crlf
end_of_line = lf
insert_final_newline = true

[*.md]
Expand Down
10 changes: 9 additions & 1 deletion src/hooks/media/add-uri-to-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ export default (): Hook => {
}.${fileExtenstion}`;
}
} else {
context.data.id = uploadPath && id? path.join(uploadPath, id): uploadPath? path.join(uploadPath,context.params.file.originalname): context.params.file.originalname;
context.data.id =
uploadPath && typeof uploadPath === 'string' && id
? path.join(uploadPath, id)
: uploadPath && typeof uploadPath === 'string'
? path.join(
uploadPath,
context.params.file.originalname || ''
)
: context.params.file.originalname || '';
}
}
return context;
Expand Down

0 comments on commit 8d7336b

Please sign in to comment.