git://git.nikiroo.be
/
nikiroo-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dde136b
)
correct err message for unsupported URLs
author
Niki Roo
<niki@nikiroo.be>
Thu, 2 Apr 2020 10:01:01 +0000
(12:01 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 2 Apr 2020 10:01:01 +0000
(12:01 +0200)
changelog-fr.md
patch
|
blob
|
blame
|
history
changelog.md
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/Main.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/supported/Text.java
patch
|
blob
|
blame
|
history
diff --git
a/changelog-fr.md
b/changelog-fr.md
index 9409b81b795d9f8e13e0f914ed6dec67084df7bd..79674a4207182cfcffb5b6f10ae25825ee95822f 100644
(file)
--- a/
changelog-fr.md
+++ b/
changelog-fr.md
@@
-1,5
+1,9
@@
# Fanfix
# Fanfix
+# Version WIP
+
+- fix: en cas d'URL non supportée, n'affiche plus un message d'erreur relatif à "file://"
+
# Version 3.0.0
- new: maintenant compatible Android (voir [companion project](https://gitlab.com/Rayman22/fanfix-android))
# Version 3.0.0
- new: maintenant compatible Android (voir [companion project](https://gitlab.com/Rayman22/fanfix-android))
diff --git
a/changelog.md
b/changelog.md
index f3033b54ce0c166257d3d2746bdc7459be913d71..223661bc7ca6f6387427f07ac1a9c00068de307f 100644
(file)
--- a/
changelog.md
+++ b/
changelog.md
@@
-1,5
+1,9
@@
# Fanfix
# Fanfix
+# Version WIP
+
+- fix: for unsupported URL, do not errors out with a "file://" related message
+
# Version 3.0.0
- new: now Android-compatible (see [companion project](https://gitlab.com/Rayman22/fanfix-android))
# Version 3.0.0
- new: now Android-compatible (see [companion project](https://gitlab.com/Rayman22/fanfix-android))
diff --git
a/src/be/nikiroo/fanfix/Main.java
b/src/be/nikiroo/fanfix/Main.java
index 0974392df9826a90b4a3dd3a6520ca52d5a1bd67..2ed276b1ea335dce6be6ed116b8e7973edd9f0ec 100644
(file)
--- a/
src/be/nikiroo/fanfix/Main.java
+++ b/
src/be/nikiroo/fanfix/Main.java
@@
-788,7
+788,7
@@
public class Main {
try {
URL source = BasicReader.getUrl(urlString);
sourceName = source.toString();
try {
URL source = BasicReader.getUrl(urlString);
sourceName = source.toString();
- if (source
.toString()
.startsWith("file://")) {
+ if (source
Name
.startsWith("file://")) {
sourceName = sourceName.substring("file://".length());
}
sourceName = sourceName.substring("file://".length());
}
diff --git
a/src/be/nikiroo/fanfix/supported/Text.java
b/src/be/nikiroo/fanfix/supported/Text.java
index daa108fc2c6a31fa322ae7b037b079a0206923a5..8af4a4084b2a2c91ca3bc0aea7f726c7781bc821 100644
(file)
--- a/
src/be/nikiroo/fanfix/supported/Text.java
+++ b/
src/be/nikiroo/fanfix/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.
/**
* Check if we supports this {@link URL}, that is, if the info file can be
* found OR not found.
+ * <p>
+ * It must also be a file, not another kind of URL.
*
* @param url
* the {@link URL} to check
*
* @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) {
* @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;
}
return infoPresent == info;
}