gaphor / gaphor

Gaphor is the simple modeling tool
https://gaphor.org
1.87k stars 200 forks source link

Error when exporting diagrams with filesystem invalid names. #2217

Closed bartlettD closed 1 year ago

bartlettD commented 1 year ago

Describe the bug

When trying to export a diagram with a character that is not permitted in the filesystem an error occurs due to Gaphor trying to use the diagram name as-is in the save dialog.

To Reproduce

Steps to reproduce the behavior:

  1. Go to '≡'
  2. Click on 'Export'
  3. Click on 'Export as SVG'
  4. See error

If possible, add the error report from (top-right menu) → ToolsError Reports.

Gaphor version:    2.17.0
Operating System:  Windows (10)
Python version:    3.11.2
GTK version:       4.8.3
Adwaita version:   1.2.1
PyGObject version: 3.42.2
Pycairo version:   1.23.0
Cairo version:     1.17.8
Pango version:     1.50.12
Display:           GdkWin32Display

Errors:

Time since application startup: 0:23:14
|Traceback (most recent call last):
|  File "C:\Program Files\Gaphor\gaphor\ui\actiongroup.pyc", line 191, in _action_activate
|  File "C:\Program Files\Gaphor\gaphor\plugins\diagramexport\__init__.pyc", line 55, in save_svg_action
|  File "C:\Program Files\Gaphor\gaphor\plugins\diagramexport\__init__.pyc", line 29, in save_dialog
|  File "C:\Program Files\Gaphor\pathlib.pyc", line 674, in with_name
|ValueError: Invalid name 'SF View 4a/b - Remote Delivery SoI Option 1'
└─────────────────────────────╌┄┈
Time since application startup: 0:23:23
|Traceback (most recent call last):
|  File "C:\Program Files\Gaphor\gaphor\ui\actiongroup.pyc", line 191, in _action_activate
|  File "C:\Program Files\Gaphor\gaphor\plugins\diagramexport\__init__.pyc", line 55, in save_svg_action
|  File "C:\Program Files\Gaphor\gaphor\plugins\diagramexport\__init__.pyc", line 29, in save_dialog
|  File "C:\Program Files\Gaphor\pathlib.pyc", line 674, in with_name
|ValueError: Invalid name 'SF View 4a/b - Remote Delivery SoI Option 1'
└─────────────────────────────╌┄┈

Expected behavior

I would expect the tool to replace or escape the invalid characters in some way for the export filename. Workaround at the moment is to rename the diagram so the save dialog opens properly but this means you cannot use filesystem invalid characters such as / in your diagram names.

Screenshots

N/A

OS

Version

Version of Gaphor: 2.17.0

Additional information

Add any other context about the problem here.

danyeaw commented 1 year ago

Hi @bartlettD, Gaphor 2.18.0 is out and should already fix this

bartlettD commented 1 year ago

Confirmed fixed in 2.18.0

amolenaar commented 1 year ago

Thanks @bartlettD for verifying. 👍