bug 8803: Allow to add an ISO with URL that doesn't end with ".iso". The check checks that the url path should end with an iso

status 8803: resolved fixed
This commit is contained in:
nit 2011-04-21 16:37:53 +05:30
parent f55e83f607
commit 8cbdfe07c9

View File

@ -224,9 +224,15 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
if (!isAdmin && zoneId == null) {
throw new InvalidParameterValueException("Please specify a valid zone Id.");
}
String urlPath = "";
try {
urlPath = (new URI(url)).getPath();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid URL " + url);
}
if((!url.toLowerCase().endsWith("iso"))&&(!url.toLowerCase().endsWith("iso.zip"))&&(!url.toLowerCase().endsWith("iso.bz2"))
&&(!url.toLowerCase().endsWith("iso.gz"))){
&&(!url.toLowerCase().endsWith("iso.gz"))
&&(!(urlPath.endsWith("iso")))){
throw new InvalidParameterValueException("Please specify a valid iso");
}