Skip to content

JS error in imagediff.js #19414

Closed
Closed
@wxiaoguang

Description

@wxiaoguang

caught by #18971 (Show JS errors) , reported by a user.

caused by imagediff.js

function getDefaultSvgBoundsIfUndefined(svgXml, src) {
  const DefaultSize = 300;
  const MaxSize = 99999;

  const svg = svgXml.rootElement; // BUG, here svg might be null, then the following `svg.width` triggers JS error

  const width = svg.width.baseVal;
  const height = svg.height.baseVal;
  if (width.unitType === SVGLength.SVG_LENGTHTYPE_PERCENTAGE || height.unitType === SVGLength.SVG_LENGTHTYPE_PERCENTAGE) {

image

Compiled JS, the index.js:37:1821 is at c=o.width

o=e.rootElement,c=o.width.baseVal,y=o.height.baseVal;if(c.unitType===SVGLength.SVG_LENGTHTYPE_PERCENTAG

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtopic/uiChange the appearance of the Gitea UItype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions