Custom photo naming expressions disappear after reopening the project
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start in the Photo attachments configuration and trace how PhotoNaming/<layer_id>/<field_name> is written to QGIS project properties and read after reopening. Verify the behavior with a field containing whitespace, a leading digit, or punctuation, then check how the Mergin mobile app reads the property. Done means the expression round-trips after reopening and remains compatible with mobile consumption.
Written by the indexing model from the issue text.
Description
Support ticket: https://odoo.lutraconsulting.co.uk/odoo/all-tickets/16929
What
In Photo attachments configuration in Project Properties, custom photo name expressions on fields with whitespace are lost after closing and reopening QGIS. Mobile fails to rename the photos.
Why
Expressions are stored as QGIS project properties under a key built from the field name:
PhotoNaming/<layer_id>/<field_name>
When QGIS writes the project, it strips characters that aren't valid in an XML element name - spaces, leading digits, punctuation. So a field named Photo before is saved as the tag <Photobefore>, but on reload the plugin looks it up by the original name Photo before, which no longer matches.
Affected: fields whose names contain spaces, start with a digit, or contain punctuation. Accented characters (ø, æ, ç) are fine.
Reproduce
- Add an attachment field whose name contains a space (e.g. pho to).
- Set a photo naming expression, apply, save the project.
- Close and reopen QGIS, reopen the project → the expression is gone.
The expression works within the session (the preview is correct), but reloading the project shows it blank.
Fix: stop embedding the names as key tokens (store the mapping as a value, e.g. JSON) - the field/layer names then round-trip safely.
Note: the Mergin mobile app reads this property too, so the storage-format change needs a matching update on the mobile side.
- Dominant language
- Python
- Stars
- 45
- Forks
- 21
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MerginMaps/qgis-plugin
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
MerginMaps/qgis-plugin#953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MerginMaps/qgis-plugin#848 · 1 comment ·
-
Project history and Remove locally fail in projects with long paths on Windows (> 260 characters)Openbug windows
Difficulty 3/5 1-2 days Newbie friendliness 55/100
MerginMaps/qgis-plugin#967 ·
-
View changes and schema check use the wrong base copy for GeoPackages in subfoldersPossibly taken @harminius claimed this 6 days ago. Openbug
MerginMaps/qgis-plugin#963 · 1 assignee ·
-
Error when syncing project.Possibly taken @harminius claimed this 7 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 54/100
MerginMaps/qgis-plugin#960 · 2 comments · 1 assignee ·
All issues in MerginMaps/qgis-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Deltares/numba_celltree#100 · 1 comment ·
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
soup airgap-bundle --bundle-size-cap nan, inf or a cap above ~1.67e299 GiB stops with an internal ValueError/OverflowError (exit 1) instead of a usage errorPossibly taken @Keshemir claimed this today. Openbug claimed difficulty:2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
MakazhanAlpamys/Soup#3045 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
dagster-io/skills#80 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day