File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 191
191
<div class="twelve wide column issue-title">
192
192
{{.i18n.Tr "repo.pulls.has_pull_request" (Escape $.RepoLink) (Escape $.RepoRelPath) .PullRequest.Index | Safe}}
193
193
<h1>
194
- <span id="issue-title">{{RenderIssueTitle .PullRequest.Issue.Title $.RepoLink $.Repository.ComposeMetas}}</span>
194
+ <span id="issue-title">{{RenderIssueTitle $.Context .PullRequest.Issue.Title $.RepoLink $.Repository.ComposeMetas}}</span>
195
195
<span class="index">#{{.PullRequest.Issue.Index}}</span>
196
196
</h1>
197
197
</div>
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
4
4
const DefaultSize = 300 ;
5
5
const MaxSize = 99999 ;
6
6
7
- const svg = svgXml . rootElement ;
8
-
9
- const width = svg . width . baseVal ;
10
- const height = svg . height . baseVal ;
7
+ const svg = svgXml . documentElement ;
8
+ const width = svg ?. width ?. baseVal ;
9
+ const height = svg ?. height ?. baseVal ;
10
+ if ( width === undefined || height === undefined ) {
11
+ return null ; // in case some svg is invalid or doesn't have the width/height
12
+ }
11
13
if ( width . unitType === SVGLength . SVG_LENGTHTYPE_PERCENTAGE || height . unitType === SVGLength . SVG_LENGTHTYPE_PERCENTAGE ) {
12
14
const img = new Image ( ) ;
13
15
img . src = src ;
@@ -29,6 +31,7 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
29
31
height : DefaultSize
30
32
} ;
31
33
}
34
+ return null ;
32
35
}
33
36
34
37
export default function initImageDiff ( ) {
@@ -88,6 +91,10 @@ export default function initImageDiff() {
88
91
info . $image . on ( 'load' , ( ) => {
89
92
info . loaded = true ;
90
93
setReadyIfLoaded ( ) ;
94
+ } ) . on ( 'error' , ( ) => {
95
+ info . loaded = true ;
96
+ setReadyIfLoaded ( ) ;
97
+ info . $boundsInfo . text ( '(image error)' ) ;
91
98
} ) ;
92
99
info . $image . attr ( 'src' , info . path ) ;
93
100
You can’t perform that action at this time.
0 commit comments