From 7ee9568bee3caddfb837007dda09460acc145177 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Thu, 20 Apr 2017 19:57:39 +0200 Subject: [PATCH] Version 1.4.2: bugfixes (unhtml, deltree) --- VERSION | 2 +- changelog | 9 +++++++++ src/be/nikiroo/utils/IOUtils.java | 13 ++++--------- src/be/nikiroo/utils/StringUtils.java | 4 +++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 347f583..9df886c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.1 +1.4.2 diff --git a/changelog b/changelog index 3cc63ad..e0bb0a4 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,12 @@ +Version 1.4.2 +------------- + +Bugfix: Deltree + Deltree was not OK for files... + +Bugfix: unhtml + Also replace non-breakable spaces by normal spaces + Version 1.4.1 ------------- diff --git a/src/be/nikiroo/utils/IOUtils.java b/src/be/nikiroo/utils/IOUtils.java index eb105e2..4a185c6 100644 --- a/src/be/nikiroo/utils/IOUtils.java +++ b/src/be/nikiroo/utils/IOUtils.java @@ -202,20 +202,15 @@ public class IOUtils { * the target to delete */ public static void deltree(File target) { - for (File file : target.listFiles()) { - if (file.isDirectory()) { + File[] files = target.listFiles(); + if (files != null) { + for (File file : files) { deltree(file); - } else { - if (!file.delete()) { - System.err.println("Cannot delete file: " - + file.getAbsolutePath()); - } } } if (!target.delete()) { - System.err.println("Cannot delete file: " - + target.getAbsolutePath()); + System.err.println("Cannot delete: " + target.getAbsolutePath()); } } diff --git a/src/be/nikiroo/utils/StringUtils.java b/src/be/nikiroo/utils/StringUtils.java index cd9a463..adebd7a 100644 --- a/src/be/nikiroo/utils/StringUtils.java +++ b/src/be/nikiroo/utils/StringUtils.java @@ -325,7 +325,9 @@ public class StringUtils { } } - return HtmlEscape.unescapeHtml(builder.toString()); + char nbsp = ' '; // non-breakable space (a special char) + char space = ' '; + return HtmlEscape.unescapeHtml(builder.toString()).replace(nbsp, space); } /** -- 2.27.0