Commit d7842372 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Removed job_id from external link generated endpoint

parent 5f7829eb
Loading
Loading
Loading
Loading
+10 −11
Original line number Original line Diff line number Diff line
@@ -130,9 +130,9 @@ public class UriService {
                                Protocol protocol = new Protocol();
                                Protocol protocol = new Protocol();
                                protocol.setUri(p.getUri());
                                protocol.setUri(p.getUri());
                                protocol.setEndpoint(endpoint);
                                protocol.setEndpoint(endpoint);
                                return protocol;                                
                                return protocol;
                            } else {
                            } else {
                                return null;                                
                                return null;
                            }
                            }
                        }).filter(Objects::nonNull)
                        }).filter(Objects::nonNull)
                        .collect(Collectors.toList());
                        .collect(Collectors.toList());
@@ -224,6 +224,10 @@ public class UriService {


        if (isLinkNode) {
        if (isLinkNode) {
            endpoint = ((LinkNode) node).getTarget();
            endpoint = ((LinkNode) node).getTarget();
            String linkTarget = ((LinkNode) node).getTarget();
            if (linkedServiceDAO.isLinkedServiceUrl(linkTarget)) {
                endpoint += "&token=" + getEndpointToken(linkTarget);
            }
        } else {
        } else {


            Location location = locationDAO.getNodeLocation(relativePath).orElse(null);
            Location location = locationDAO.getNodeLocation(relativePath).orElse(null);
@@ -238,17 +242,12 @@ public class UriService {
            } else {
            } else {
                endpoint = fileServiceUrl + urlEncodePath(relativePath);
                endpoint = fileServiceUrl + urlEncodePath(relativePath);
            }
            }
        }


        endpoint += "?jobId=" + job.getJobId();
            endpoint += "?jobId=" + job.getJobId();


        if (isLinkNode) {
            if (!"true".equals(NodeProperties.getNodePropertyByURI(node, NodeProperties.PUBLIC_READ_URI))) {
            String linkTarget = ((LinkNode) node).getTarget();
                endpoint += "&token=" + getEndpointToken(fileServiceUrl + relativePath);
            if (linkedServiceDAO.isLinkedServiceUrl(linkTarget)) {
                endpoint += "&token=" + getEndpointToken(linkTarget);
            }
            }
        } else if (!"true".equals(NodeProperties.getNodePropertyByURI(node, NodeProperties.PUBLIC_READ_URI))) {
            endpoint += "&token=" + getEndpointToken(fileServiceUrl + relativePath);
        }
        }


        return endpoint;
        return endpoint;
@@ -364,7 +363,7 @@ public class UriService {
            return this.uri;
            return this.uri;
        }
        }


        public boolean isEndpointCompliant(String endpoint) {            
        public boolean isEndpointCompliant(String endpoint) {
            return endpoint.toLowerCase()
            return endpoint.toLowerCase()
                    .startsWith(this.protocolString + "://");
                    .startsWith(this.protocolString + "://");
        }
        }