mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
CSV export: allow spaces on filename and fix tests
This commit is contained in:
@@ -366,9 +366,9 @@ public class HabitTest extends BaseTest
|
|||||||
HabitFixtures.createShortHabit();
|
HabitFixtures.createShortHabit();
|
||||||
|
|
||||||
String expectedCSV =
|
String expectedCSV =
|
||||||
"Name,Description,NumRepetitions,Interval,Color\n" +
|
"Position,Name,Description,NumRepetitions,Interval,Color\n" +
|
||||||
"Meditate,Did you meditate this morning?,1,1,#AFB42B\n" +
|
"001,Meditate,Did you meditate this morning?,1,1,#AFB42B\n" +
|
||||||
"Wake up early,Did you wake up before 6am?,2,3,#00897B\n";
|
"002,Wake up early,Did you wake up before 6am?,2,3,#00897B\n";
|
||||||
|
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
Habit.writeCSV(Habit.getAll(true), writer);
|
Habit.writeCSV(Habit.getAll(true), writer);
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class HabitsCSVExporter
|
|||||||
@NonNull
|
@NonNull
|
||||||
private String sanitizeFilename(String name)
|
private String sanitizeFilename(String name)
|
||||||
{
|
{
|
||||||
String s = name.replaceAll("[^a-zA-Z0-9\\._-]+", "");
|
String s = name.replaceAll("[^ a-zA-Z0-9\\._-]+", "");
|
||||||
return s.substring(0, Math.min(s.length(), 100));
|
return s.substring(0, Math.min(s.length(), 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user