volume upload: added the url validation check when url is not null

This commit is contained in:
Rajani Karuturi 2014-12-16 15:41:27 +05:30
parent f70a2a1486
commit 36c0c38ab8

View File

@ -183,10 +183,10 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
throw new InvalidParameterValueException("Please specify a valid zone Id. Only admins can create templates in all zones.");
}
//TODO: commenting it for post upload to work as it doesnt have an url. Need to figure out how to resolve this
// if (url.toLowerCase().contains("file://")) {
// throw new InvalidParameterValueException("File:// type urls are currently unsupported");
// }
// check for the url format only when url is not null. url can be null incase of form based upload
if (url != null && url.toLowerCase().contains("file://")) {
throw new InvalidParameterValueException("File:// type urls are currently unsupported");
}
// check whether owner can create public templates
boolean allowPublicUserTemplates = TemplateManager.AllowPublicUserTemplates.valueIn(templateOwner.getId());