remove invalid excel worksheet characters
This commit is contained in:
parent
ea4bb93bba
commit
fcea7c4f85
2 changed files with 3 additions and 2 deletions
|
@ -36,7 +36,8 @@ class Champs::RepetitionChamp < Champ
|
|||
# We have to truncate the label here as spreadsheets have a (30 char) limit on length.
|
||||
def libelle_for_export
|
||||
str = "(#{type_de_champ.stable_id}) #{libelle}"
|
||||
ActiveStorage::Filename.new(str).sanitized.truncate(30)
|
||||
# /\*?[] are invalid Excel worksheet characters
|
||||
ActiveStorage::Filename.new(str.delete('[]*?')).sanitized.truncate(30)
|
||||
end
|
||||
|
||||
class Row < Hashie::Dash
|
||||
|
|
|
@ -334,7 +334,7 @@ describe ProcedureExportService do
|
|||
|
||||
context 'with invalid characters' do
|
||||
before do
|
||||
champ_repetition.type_de_champ.update(libelle: 'A / B \ C')
|
||||
champ_repetition.type_de_champ.update(libelle: 'A / B \ C *[]?')
|
||||
end
|
||||
|
||||
it 'should have valid sheet name' do
|
||||
|
|
Loading…
Reference in a new issue