Skip to content

Commit

Permalink
Merge pull request #546 from meshery/MUzairS15/chore
Browse files Browse the repository at this point in the history
update function
  • Loading branch information
Mohd Uzair authored Jul 31, 2024
2 parents 5a5024d + b6d5653 commit ba3a613
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/svg_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
const XMLTAG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg>"

// UpdateSVGString updates the width and height attributes of an SVG file and returns the modified SVG as a string.
func UpdateSVGString(svgStr string, width, height int) (string, error) {
func UpdateSVGString(svgStr string, width, height int, skipHeader bool) (string, error) {
// Create a reader for the SVG string.
r := strings.NewReader(svgStr)

Expand Down Expand Up @@ -99,8 +99,10 @@ func UpdateSVGString(svgStr string, width, height int) (string, error) {
return "", err
}
var svg string
if b.String() != "" {
if b.String() != "" && !skipHeader {
svg = XMLTAG + b.String()
} else {
svg = b.String()
}
return svg, nil
}

0 comments on commit ba3a613

Please sign in to comment.