MerginMaps / MerginMaps/mobile

Photo naming expression returns NULL value in some cases

Open
#4,622 1 comment 0 reactions 1 assignee View on GitHub

@xkello is already working on this.

Since Aug 11, 2026.

bug data corruption - sync failure - crash - anr photo-refactoring
Dominant language
C++
Stars
388
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
20

Description

In some cases the photo naming expression will fail due to a NULL value in a field used in the naming expression. This results in a NULL value for the photo name. For some reason, the photo renaming check doesn't catch this and replace it with a valid character so it creates file names that are prohibited like this:

Image

Since there is no way to rename the photo in the app, the user is unable to sync. This can be further complicated if the device is an iOS device because it is not possible to access the project files and the unallowed filename prevents file transfer to another device.

### To reproduce the issue:

1. Create a project with a survey layer that contains a photo field and at least one other text entry field like `name`
2. In project settings, set a photo naming expression that includes the text input field, example: `"name" || '-' || format_date(now(), 'yyyyMMdd_HHmmss')`
3. In the mobile app, create a feature but leave the 'name' field blank and attach a photo, this will create a photo with an empty space for a filename
4. Repeat the previous step to create a second photo with no filename, the device will rename it ` (1).jpg`
5. Try to sync, you should get the error but there is no way to rename the files and complete the sync

### Workaround
It is possible to avoid this by wrapping any field in the naming expression in a coalesce() function. For example, the previous expression would look like:
`coalesce("name", 'no_name') || '-' || format_date(now(), 'yyyyMMdd_HHmmss')`

It would be helpful if the app could catch these instances and either replace the null value with something else, give the user an option to rename the file, or revert to the device's default photo name.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.