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:
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:
- Create a project with a survey layer that contains a photo field and at least one other text entry field like
name
- In project settings, set a photo naming expression that includes the text input field, example:
"name" || '-' || format_date(now(), 'yyyyMMdd_HHmmss')
- 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
- Repeat the previous step to create a second photo with no filename, the device will rename it
(1).jpg
- 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.
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:
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:
name"name" || '-' || format_date(now(), 'yyyyMMdd_HHmmss')(1).jpgWorkaround
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.