2
0

🚸 Enable OneDrive video url parsing

This commit is contained in:
Baptiste Arnaud
2024-01-31 08:29:44 +01:00
parent ff9c4726cc
commit 8ad4a0996c
2 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import {
VideoBubbleContentType,
gumletRegex,
horizontalVideoSuggestionSize,
oneDriveRegex,
tiktokRegex,
verticalVideoSuggestionSize,
vimeoRegex,
@ -70,5 +71,13 @@ export const parseVideoUrl = (
videoSizeSuggestion: horizontalVideoSuggestionSize,
}
}
if (oneDriveRegex.test(url)) {
const match = url.match(oneDriveRegex)
const parsedUrl = match?.at(0) ?? url
return {
type: VideoBubbleContentType.URL,
url: parsedUrl.replace('/embed', '/download'),
}
}
return { type: VideoBubbleContentType.URL, url }
}