JAL-629 Fixed appending URLs
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 27 Apr 2023 17:36:24 +0000 (18:36 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 27 Apr 2023 17:36:24 +0000 (18:36 +0100)
src/jalview/bin/Commands.java

index dafc342..30e71b6 100644 (file)
@@ -214,6 +214,7 @@ public class Commands
         }
 
         af = afMap.get(id);
+        // When to open a new AlignFrame
         if (af == null || "true".equals(av.getSubVal("new"))
                 || a == Arg.OPEN || format == FileFormat.Jalview)
         {
@@ -331,7 +332,12 @@ public class Commands
         {
           Console.debug(
                   "Opening '" + openFile + "' in existing alignment frame");
-          af.getCurrentView().addFile(new File(openFile), format, false);
+          DataSourceType dst = HttpUtils.startsWithHttpOrHttps(openFile)
+                  ? DataSourceType.URL
+                  : DataSourceType.FILE;
+          FileLoader fileLoader = new FileLoader(!headless);
+          fileLoader.LoadFile(af.getCurrentView(), openFile, dst, null,
+                  false);
         }
 
         Console.debug("Command " + Arg.APPEND + " executed successfully!");