File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 191191 <div class="twelve wide column issue-title">
192192 {{.i18n.Tr "repo.pulls.has_pull_request" (Escape $.RepoLink) (Escape $.RepoRelPath) .PullRequest.Index | Safe}}
193193 <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>
195195 <span class="index">#{{.PullRequest.Issue.Index}}</span>
196196 </h1>
197197 </div>
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
44 const DefaultSize = 300 ;
55 const MaxSize = 99999 ;
66
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+ }
1113 if ( width . unitType === SVGLength . SVG_LENGTHTYPE_PERCENTAGE || height . unitType === SVGLength . SVG_LENGTHTYPE_PERCENTAGE ) {
1214 const img = new Image ( ) ;
1315 img . src = src ;
@@ -29,6 +31,7 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
2931 height : DefaultSize
3032 } ;
3133 }
34+ return null ;
3235}
3336
3437export default function initImageDiff ( ) {
@@ -88,6 +91,10 @@ export default function initImageDiff() {
8891 info . $image . on ( 'load' , ( ) => {
8992 info . loaded = true ;
9093 setReadyIfLoaded ( ) ;
94+ } ) . on ( 'error' , ( ) => {
95+ info . loaded = true ;
96+ setReadyIfLoaded ( ) ;
97+ info . $boundsInfo . text ( '(image error)' ) ;
9198 } ) ;
9299 info . $image . attr ( 'src' , info . path ) ;
93100
You can’t perform that action at this time.
0 commit comments