Skip to content

Commit

Permalink
fix(post): improve URL detection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Oct 5, 2021
1 parent 1d4b58c commit c9461fb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/pages/posts/post/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,15 @@ export default {
return false
}
return this.post.data.source[0].startsWith('http', 'www')
let sourceUrl
try {
sourceUrl = new URL(this.post.data.source[0])
} catch {
return false
}
return sourceUrl.protocol === 'http:' || sourceUrl.protocol === 'https:'
},
sourceText() {
Expand Down

0 comments on commit c9461fb

Please sign in to comment.