The cause of the bug is that the return value of request.POST.get('delete_data', False) is a string, but later on it is used as a boolean. The simple fix in this patch is to convert the value to a boolean, but maybe there is a more clever way.
By the way, I noticed that when deleting record data, only files recorded by Sumatra are deleted whereas directories are left alone. Is there an easy way to delete those as well? I personally always store all data from separate runs in subdirectories of the form Data/RECORD_LABEL, so ideally I'd like to have that whole subdirectory deleted if I'd like to discard data from one particular run. But I appreciate it may not be easy to find a general solution that works for all setups.