def get_corrected_filename(filename): # Use algorithm og https://github.com/stakiran/vscode-scb/blob/master/language-feature/src/util.ts#L29 invalid_chars ='\\/:*?"<>|' noisy_chars =' ' target_chars = invalid_chars + noisy_chars after_char = '_' ret = filename for target_char in target_chars: ret = ret.replace(target_char, after_char) return ret