From 653a05273d96d91b6b12b19cf62aa4da4664c0be Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Mon, 3 Oct 2016 17:00:04 +0200 Subject: [PATCH] Check sanitaryName only on basename without extension This regression originates from: 8725bb1e Clean up sketch loading before this commit the sketch name sanitization was made on the sketch name without the extension. After 8725bb1e instead the name sanitization is made on the filename, so including the ".ino" extension. This lead to a weird corner case, caused by the limit of 63 characters on the sketch name: before 8725bb1e it would be possible to save a sketch with a name of exactly 63 characters, but after 8725bb1e this sketch will suddenly becomes invalid becuase the 63 chars name + extension would exceed the 63 characters limit. This commit fix this regression. Fix #5431 --- arduino-core/src/processing/app/Sketch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino-core/src/processing/app/Sketch.java b/arduino-core/src/processing/app/Sketch.java index 3022b9cd4..11b57ab3b 100644 --- a/arduino-core/src/processing/app/Sketch.java +++ b/arduino-core/src/processing/app/Sketch.java @@ -106,7 +106,7 @@ public class Sketch { private List listSketchFiles(boolean showWarnings) throws IOException { Set result = new TreeSet<>(CODE_DOCS_COMPARATOR); for (File file : FileUtils.listFiles(folder, false, EXTENSIONS)) { - if (BaseNoGui.isSanitaryName(file.getName())) { + if (BaseNoGui.isSanitaryName(FileUtils.splitFilename(file).basename)) { result.add(new SketchFile(this, file)); } else if (showWarnings) { System.err.println(I18n.format(tr("File name {0} is invalid: ignored"), file.getName()));