Skip to content

Error changing logo to SVG with prefers-color-scheme styling #29326

Closed
@pboguslawski

Description

@pboguslawski

Description

When changing logo to SVG file that contains dark mode styling i.e.

<?xml version="1.0" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
  <style>
    path { fill: black }
    @media (prefers-color-scheme: dark) { path { fill: white } }
  </style>
[...]

make generate-images throws error like

$ make generate-images
npm install --no-save --no-package-lock fabric@5 imagemin-zopfli@7

up to date in 44s
node build/generate-images.js 
TypeError: Cannot read properties of undefined (reading 'trim')
    at /mypath/gitea/node_modules/fabric/dist/fabric.js:5434:33
    at Array.forEach (<anonymous>)
    at Object.getCSSRules (/mypath/gitea/node_modules/fabric/dist/fabric.js:5425:15)
    at fabric.parseSVGDocument (/mypath/gitea/node_modules/fabric/dist/fabric.js:5150:38)
    at Object.loadSVGFromString (/mypath/gitea/node_modules/fabric/dist/fabric.js:5499:14)
    at file:///mypath/gitea/build/generate-images.js:14:12
    at new Promise (<anonymous>)
    at loadSvg (file:///mypath/gitea/build/generate-images.js:13:10)
    at generate (file:///mypath/gitea/build/generate-images.js:38:36)
    at main (file:///mypath/gitea/build/generate-images.js:73:5)
make: *** [Makefile:1013: generate-images] Error 1

No such problem when

@media (prefers-color-scheme: dark) { path { fill: white } }

is removed from svg file.

Gitea Version

1.21.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Compiled from source.

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugtype/upstreamThis is an issue in one of Gitea's dependencies and should be reported there

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions