Skip to content

XCF export fails if layer has forward slash

Summary:

When exporting as an XCF file the export fails if a layer contains a forward slash (/).

Steps to reproduce:

  • open Inkscape
  • create a layer with a forward slash in the name
  • Go to File > Save As
  • Choose XCF

What happened?

Inkscape displays the following error and export fails

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/gimp_xcf.py", line 201, in <module>
    GimpXcf().run()
  File "/usr/share/inkscape/extensions/inkex/base.py", line 252, in run
    self.save_raw(self.effect())
  File "/usr/share/inkscape/extensions/inkex/base.py", line 298, in save_raw
    self.save(self.options.output)
  File "/usr/share/inkscape/extensions/gimp_xcf.py", line 116, in save
    pngs[name] = take_snapshot(
                 ^^^^^^^^^^^^^^
  File "/usr/share/inkscape/extensions/inkex/command.py", line 334, in take_snapshot
    svg_file = write_svg(svg, dirname, name + ".svg")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/inkscape/extensions/inkex/command.py", line 136, in write_svg
    with open(filename, "wb") as fhl:
         ^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/gimp-out-54xn9r4c/Circles/Squares.svg'

What should have happened?

SVG exported as an XCF file.

Sample attachments:

test.svg

Version info

Inkscape 1.4 (1:1.4+202410161351+e7c3feb100)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information