Skip to content

Inform users about use of forbidden characters #678

@gioman

Description

@gioman

I have setup a project and i MM properties set up the photo name as

'media/tampa_' || now()

which returns something like

Image

This is ok on the mobile that syncs no problem, but the plugin spits out this python error:

Traceback (most recent call last):

  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\test/python/plugins\Mergin\sync_dialog.py", line 275, in pull_timer_tick
    is_running = pull_project_is_running(self.job)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\test/python/plugins\Mergin\mergin\client_pull.py", line 527, in pull_project_is_running
    raise future.exception()

  File "C:\OSGeo4W\apps\Python312\Lib\concurrent\futures\thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\test/python/plugins\Mergin\mergin\client_pull.py", line 95, in _do_download
    item.download_blocking(mc, mp, project_path)

  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\test/python/plugins\Mergin\mergin\client_pull.py", line 324, in download_blocking
    save_to_file(resp, self.download_file_path)

  File "C:\Users/giovanni/AppData/Roaming/QGIS/QGIS3\profiles\test/python/plugins\Mergin\mergin\utils.py", line 39, in save_to_file
    with open(path, "wb") as output:
         ^^^^^^^^^^^^^^^^

OSError: [Errno 22] Invalid argument: 'C:\\Users\\giovanni\\Documents\\test\\.mergin\\fetch_v10-v11\\media\\tampa_2025-03-13T20:53:24.694.jpg.0'

Maybe would be better to not allow characters like "-" or "/" in the expression to set the photo path and name.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttest - successui/uxRelated to user interface / user experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions