Downloader: offline mode: allow local files
authorNiki Roo <niki@nikiroo.be>
Thu, 19 Sep 2019 06:40:23 +0000 (08:40 +0200)
committerNiki Roo <niki@nikiroo.be>
Thu, 19 Sep 2019 06:40:23 +0000 (08:40 +0200)
src/be/nikiroo/utils/Downloader.java

index c9a319aa0eb725159287562ae76718fc531c8097..0487933295ec8c4902665d2bffcd81e57debda2c 100644 (file)
@@ -281,7 +281,9 @@ public class Downloader {
                        }
                }
 
-               if (offline) {
+               String protocol = originalUrl == null ? null : originalUrl
+                               .getProtocol();
+               if (isOffline() && !"file".equalsIgnoreCase(protocol)) {
                        tracer.error("Downloader OFFLINE, cannot proceed to URL: " + url);
                        throw new IOException("Downloader is currently OFFLINE, cannot download: " + url);
                }