File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ function openGraphHelper(options = {}) {
115115 result += og ( 'og:locale' , localeToTerritory ( language ) , false ) ;
116116 }
117117
118- images = images . map ( path => new URL ( path , url || config . url ) . toString ( ) ) ;
118+ images = images . map ( path => new URL ( path , url || config . url ) . toString ( ) )
119+ . filter ( url => ! url . startsWith ( 'data:' ) ) ;
119120
120121 images . forEach ( path => {
121122 result += og ( 'og:image' , path , false ) ;
Original file line number Diff line number Diff line change @@ -211,6 +211,18 @@ describe('open_graph', () => {
211211 result . should . have . string ( meta ( { property : 'og:image' , content : 'https://hexo.io/test.jpg' } ) ) ;
212212 } ) ;
213213
214+ it ( 'images - content with data-uri' , ( ) => {
215+ const result = openGraph . call ( {
216+ page : {
217+ content : '<img src="data:image/svg+xml;utf8,<svg>...</svg>">'
218+ } ,
219+ config : hexo . config ,
220+ is_post : isPost
221+ } ) ;
222+
223+ result . should . not . have . string ( meta ( { property : 'og:image' , content : 'data:image/svg+xml;utf8,<svg>...</svg>' } ) ) ;
224+ } ) ;
225+
214226 it ( 'images - string' , ( ) => {
215227 const result = openGraph . call ( {
216228 page : {
You can’t perform that action at this time.
0 commit comments