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 = {}) {
115
115
result += og ( 'og:locale' , localeToTerritory ( language ) , false ) ;
116
116
}
117
117
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:' ) ) ;
119
120
120
121
images . forEach ( path => {
121
122
result += og ( 'og:image' , path , false ) ;
Original file line number Diff line number Diff line change @@ -211,6 +211,18 @@ describe('open_graph', () => {
211
211
result . should . have . string ( meta ( { property : 'og:image' , content : 'https://hexo.io/test.jpg' } ) ) ;
212
212
} ) ;
213
213
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
+
214
226
it ( 'images - string' , ( ) => {
215
227
const result = openGraph . call ( {
216
228
page : {
You can’t perform that action at this time.
0 commit comments