Skip to content

Commit

Permalink
update function
Browse files Browse the repository at this point in the history
Signed-off-by: MUzairS15 <[email protected]>
  • Loading branch information
MUzairS15 committed Jul 31, 2024
1 parent fd9565f commit b6d5653
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 b6d5653

Please sign in to comment.