Skip to content

Commit 653a052

Browse files
committed
Check sanitaryName only on basename without extension
This regression originates from: 8725bb1 Clean up sketch loading before this commit the sketch name sanitization was made on the sketch name without the extension. After 8725bb1 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 8725bb1 it would be possible to save a sketch with a name of exactly 63 characters, but after 8725bb1 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
1 parent bc5c9b8 commit 653a052

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arduino-core/src/processing/app/Sketch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public boolean reload() throws IOException {
106106
private List<SketchFile> listSketchFiles(boolean showWarnings) throws IOException {
107107
Set<SketchFile> result = new TreeSet<>(CODE_DOCS_COMPARATOR);
108108
for (File file : FileUtils.listFiles(folder, false, EXTENSIONS)) {
109-
if (BaseNoGui.isSanitaryName(file.getName())) {
109+
if (BaseNoGui.isSanitaryName(FileUtils.splitFilename(file).basename)) {
110110
result.add(new SketchFile(this, file));
111111
} else if (showWarnings) {
112112
System.err.println(I18n.format(tr("File name {0} is invalid: ignored"), file.getName()));

0 commit comments

Comments
 (0)