Skip to content

JS error in imagediff.js #19414

@wxiaoguang

Description

@wxiaoguang
Contributor

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

Activity

added
topic/uiChange the appearance of the Gitea UI
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implemented
on Apr 16, 2022
added this to the 1.17.0 milestone on Apr 16, 2022
KN4CK3R

KN4CK3R commented on Apr 17, 2022

@KN4CK3R
Member

Do you have an example svg?

wxiaoguang

wxiaoguang commented on Apr 17, 2022

@wxiaoguang
ContributorAuthor

No, I have asked but the reporter can not provide more information.

wxiaoguang

wxiaoguang commented on Apr 17, 2022

@wxiaoguang
ContributorAuthor
wxiaoguang

wxiaoguang commented on Apr 25, 2022

@wxiaoguang
ContributorAuthor

I proposed a fix #19494

locked and limited conversation to collaborators on May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Relationships

    None yet

      Participants

      @KN4CK3R@wxiaoguang

      Issue actions

        JS error in imagediff.js · Issue #19414 · go-gitea/gitea