Skip to content

Commit

Permalink
fix the regex that did not detect items with nothing in []
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Apr 4, 2024
1 parent d76320c commit 0bdeba9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/personal-cloud/background/handle-incoming-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ function maybeReplaceAnnotCommentImages(
imageSupportBG: ImageSupportBackground,
): Promise<void>[] {
// Should match the data URL part of a markdown string containing something like this: "![alt text](data:image/png;base64,asdafasf)"
const dataUrlExtractRegexp = /!\[[\w|\s|\.|\!|\-|\?|=]*\]\((data:image\/(png|jpeg);base64,[\w|\+|\/|=]+)\)/g
const dataUrlExtractRegexp = /!\[.*?\]\((data:image\/(?:png|jpeg|gif);base64,[\w+/=]+)\)/g
// Most comments should exit here
if (!dataUrlExtractRegexp.test(annotation.comment)) {
return []
}

dataUrlExtractRegexp.lastIndex = 0 // Reset lastIndex to 0
const matches = annotation.comment.matchAll(dataUrlExtractRegexp)
const dataUrlToImageId = new Map<string, string>()
const imageUploadPromises: Promise<void>[] = []
Expand Down
3 changes: 0 additions & 3 deletions src/search-injection/components/youtubeActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export default class YoutubeButtonMenu extends React.Component<Props, State> {
}
browser.runtime.onMessage.addListener((message) => {
if (message.type === 'URL_CHANGE') {
console.log('URL_CHANGE', message.url)
this.getYoutubeVideoDuration()
}
})
Expand All @@ -120,7 +119,6 @@ export default class YoutubeButtonMenu extends React.Component<Props, State> {
if (video) {
let duration = video.duration

console.log('duration', duration)
this.setState({
videoDuration: duration,
})
Expand Down Expand Up @@ -200,7 +198,6 @@ export default class YoutubeButtonMenu extends React.Component<Props, State> {
let timestampToSend = null

if (event.shiftKey) {
console.log('Shift key is pressed during click')
const range = this.calculateRangeInSeconds(
this.state.videoDuration,
from,
Expand Down

0 comments on commit 0bdeba9

Please sign in to comment.