aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2020-01-20 13:42:33 +0100
committerGitHub <noreply@github.com>2020-01-20 13:42:33 +0100
commitb8ab3995be0424272f1eb03337ee228e849f6dd3 (patch)
treeb0a0761e8ddc1dd3f622a3bdee2bf8aef0bc0ca4
parenta8e70fcd502038d96b8829de501d564e62c7ff8a (diff)
parenta737add463949a9e59754af5f5982121f5e606a5 (diff)
Merge pull request #11857 from vespa-engine/jvenstad/optional-submission-data
Require scheme and host as well
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationVersion.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java5
2 files changed, 5 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationVersion.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationVersion.java
index 685eed22699..bbe533db9b5 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationVersion.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationVersion.java
@@ -51,8 +51,6 @@ public class ApplicationVersion implements Comparable<ApplicationVersion> {
if (commit.isPresent() && commit.get().length() > 128)
throw new IllegalArgumentException("Commit may not be longer than 128 characters");
- sourceUrl.map(URI::create);
-
if (authorEmail.isPresent() && ! authorEmail.get().matches("[^@]+@[^@]+"))
throw new IllegalArgumentException("Invalid author email '" + authorEmail.get() + "'.");
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
index 0c0b1f67b90..6db665ae143 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java
@@ -1998,6 +1998,11 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
Optional<String> sourceUrl = optional("sourceUrl", submitOptions);
Optional<String> authorEmail = optional("authorEmail", submitOptions);
+ sourceUrl.map(URI::create).ifPresent(url -> {
+ if (url.getHost() == null || url.getScheme() == null)
+ throw new IllegalArgumentException("Source URL must include scheme and host");
+ });
+
ApplicationPackage applicationPackage = new ApplicationPackage(dataParts.get(EnvironmentResource.APPLICATION_ZIP), true);
controller.applications().verifyApplicationIdentityConfiguration(TenantName.from(tenant),