richsmith / sexytopo

The SexyTopo cave surveying app for Android
GNU General Public License v3.0
29 stars 13 forks source link

Sanitise Station Name on Rename #183

Closed olly closed 1 year ago

olly commented 1 year ago

In #182 it appears a Survey Station was erroneously renamed an included a \n newline character. This appears to have been guarded against in the Station constructors:

https://github.com/richsmith/sexytopo/blob/ef7f19146425cfb7db78f1225a0bda1f51527b85/app/src/main/java/org/hwyl/sexytopo/model/survey/Station.java#L21-L28

but the renameStation method of SurveyUpdater calls setName, which doesn't utilise sanitiseName.

https://github.com/richsmith/sexytopo/blob/ef7f19146425cfb7db78f1225a0bda1f51527b85/app/src/main/java/org/hwyl/sexytopo/control/util/SurveyUpdater.java#L224-L231

This PR rectifies that by calling sanitiseName in the setter, ensuring the value is stored in its sanitised form.