Commit 2ad586a1 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed issue in link nodes paths

parent fbbe963a
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -159,7 +159,8 @@ public class MainNodesHtmlGenerator extends NodesHtmlGenerator {
            Element link = cell.appendElement("a");
            Element link = cell.appendElement("a");
            String href;
            String href;
            if (nodeInfo.isFolder()) {
            if (nodeInfo.isFolder()) {
                href = "#/nodes" + urlEncodePath(nodeInfo.getPath());
                String path = nodeInfo.isLink() ? nodeInfo.getTarget() : nodeInfo.getPath();
                href = "#/nodes" + urlEncodePath(path);
            } else {
            } else {
                href = "download" + urlEncodePath(nodeInfo.getPath());
                href = "download" + urlEncodePath(nodeInfo.getPath());
                link.attr("target", "blank_");
                link.attr("target", "blank_");
+8 −9
Original line number Original line Diff line number Diff line
@@ -14,7 +14,6 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Arrays;
import java.util.Optional;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Collectors;
import net.ivoa.xml.vospace.v2.ContainerNode;
import net.ivoa.xml.vospace.v2.DataNode;
import net.ivoa.xml.vospace.v2.DataNode;
import net.ivoa.xml.vospace.v2.LinkNode;
import net.ivoa.xml.vospace.v2.LinkNode;
import net.ivoa.xml.vospace.v2.Node;
import net.ivoa.xml.vospace.v2.Node;
@@ -28,7 +27,7 @@ public class NodeInfo {


    private final String authority;
    private final String authority;


    private String path;
    private final String path;
    private final String name;
    private final String name;
    private final String size;
    private final String size;
    private String type;
    private String type;
@@ -41,7 +40,7 @@ public class NodeInfo {
    private final boolean busy;
    private final boolean busy;
    private final boolean writable;
    private final boolean writable;
    private final boolean deletable;
    private final boolean deletable;
    private final boolean link;
    private String target;


    public NodeInfo(Node node, User user, String authority, Node linkedNode) {
    public NodeInfo(Node node, User user, String authority, Node linkedNode) {
        this.authority = authority;
        this.authority = authority;
@@ -58,13 +57,9 @@ public class NodeInfo {
        this.busy = isBusy(node);
        this.busy = isBusy(node);
        this.writable = NodeUtils.checkIfWritable(node, user.getName(), user.getGroups()) && !busy;
        this.writable = NodeUtils.checkIfWritable(node, user.getName(), user.getGroups()) && !busy;
        this.deletable = writable && !sticky && !asyncTrans;
        this.deletable = writable && !sticky && !asyncTrans;
        this.link = linkedNode != null;
        if (linkedNode != null) {
        if (linkedNode != null) {
            String prefix = "vos://" + authority;
            String prefix = "vos://" + authority;
            String target = ((LinkNode) node).getTarget();
            this.target = decodePath(((LinkNode) node).getTarget(), prefix);
            if (linkedNode instanceof ContainerNode) {
                this.path = decodePath(target, prefix);
            }
            this.type = linkedNode.getType();
            this.type = linkedNode.getType();
        }
        }
    }
    }
@@ -209,7 +204,11 @@ public class NodeInfo {
        return deletable;
        return deletable;
    }
    }


    public String getTarget() {
        return target;
    }

    public boolean isLink() {
    public boolean isLink() {
        return link;
        return target != null;
    }
    }
}
}