comparison env/lib/python3.7/site-packages/schema_salad/java/main_utils/DefaultFetcher.java @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 package ${package}.utils;
2
3 import java.net.URI;
4
5 public class DefaultFetcher implements Fetcher {
6
7 public String urlJoin(final String baseUrl, final String url) {
8 if (url.startsWith("_:")) {
9 return url;
10 }
11
12 final URI baseUri = Uris.toUri(baseUrl);
13 final URI uri = Uris.toUri(url);
14 if (baseUri.getScheme() != null
15 && !baseUri.getScheme().equals("file")
16 && "file".equals(uri.getScheme())) {
17 throw new ValidationException(
18 String.format(
19 "Not resolving potential remote exploit %s from base %s".format(url, baseUrl)));
20 }
21 String result = baseUri.resolve(uri).toString();
22 if (result.startsWith("file:")) {
23 // Well this is gross - needed for http as well?
24 result = "file://" + result.substring("file:".length());
25 }
26 return result;
27 }
28
29 public String fetchText(final String url) {
30 return "fetched";
31 }
32 }