From: Niki Roo Date: Thu, 2 Apr 2020 10:03:23 +0000 (+0200) Subject: Merge branch 'master' into subtree X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=commitdiff_plain;h=669a62833b4458bad0772debdd06921080500221;hp=eaeebfe325b71b7286a2ad61136a40a1c0bbb50f Merge branch 'master' into subtree --- diff --git a/Main.java b/Main.java index 0974392..2ed276b 100644 --- a/Main.java +++ b/Main.java @@ -788,7 +788,7 @@ public class Main { try { URL source = BasicReader.getUrl(urlString); sourceName = source.toString(); - if (source.toString().startsWith("file://")) { + if (sourceName.startsWith("file://")) { sourceName = sourceName.substring("file://".length()); } diff --git a/supported/Text.java b/supported/Text.java index daa108f..8af4a40 100644 --- a/supported/Text.java +++ b/supported/Text.java @@ -288,6 +288,8 @@ class Text extends BasicSupport { /** * Check if we supports this {@link URL}, that is, if the info file can be * found OR not found. + *

+ * It must also be a file, not another kind of URL. * * @param url * the {@link URL} to check @@ -297,21 +299,23 @@ class Text extends BasicSupport { * @return TRUE if it is supported */ protected boolean supports(URL url, boolean info) { - boolean infoPresent = false; - if ("file".equals(url.getProtocol())) { - File file; - try { - file = new File(url.toURI()); - file = assureNoTxt(file); - file = new File(file.getPath() + ".info"); - } catch (URISyntaxException e) { - Instance.getTraceHandler().error(e); - file = null; - } + if (!"file".equals(url.getProtocol())) { + return false; + } - infoPresent = (file != null && file.exists()); + boolean infoPresent = false; + File file; + try { + file = new File(url.toURI()); + file = assureNoTxt(file); + file = new File(file.getPath() + ".info"); + } catch (URISyntaxException e) { + Instance.getTraceHandler().error(e); + file = null; } + infoPresent = (file != null && file.exists()); + return infoPresent == info; }