Skip to content

Commit

Permalink
Fix: handle undefined 'file' in notion block rendering (#3440)
Browse files Browse the repository at this point in the history
A monitor failed because the image-type block retrieved by notion did not have
`file` set (although it should have according to notion doc).
Details [here](https://dust4ai.slack.com/archives/C05F84CFP0E/p1706211445242809)

This PR handles that situation.
  • Loading branch information
philipperolet authored Jan 25, 2024
1 parent 921f15d commit 9ddbb97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion connectors/src/connectors/notion/lib/notion_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ export function parsePageBlock(block: BlockObjectResponse): ParsedNotionBlock {
const fileUrl =
"external" in fileContainer
? fileContainer.external.url
: fileContainer.file.url;
: fileContainer.file?.url || "NO_URL";
const caption = parseRichText(fileContainer.caption);
const fileText =
caption && caption.length
Expand Down

0 comments on commit 9ddbb97

Please sign in to comment.