From 83bd4d60f118050840cf53e96369999c6e0582ad Mon Sep 17 00:00:00 2001 From: Min Chen Date: Mon, 11 Aug 2014 17:04:06 -0700 Subject: [PATCH] Revert "CLOUDSTACK-7312:ISOs cannot be downloaded from URLs without matching" This reverts commit 737f76df8c86666b47ba347ae46fc10d73b1fee6. --- .../src/com/cloud/template/HypervisorTemplateAdapter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java index 419a501443c..51dedf76973 100755 --- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java +++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java @@ -113,6 +113,12 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { public TemplateProfile prepare(RegisterIsoCmd cmd) throws ResourceAllocationException { TemplateProfile profile = super.prepare(cmd); String url = profile.getUrl(); + + if ((!url.toLowerCase().endsWith("iso")) && (!url.toLowerCase().endsWith("iso.zip")) && (!url.toLowerCase().endsWith("iso.bz2")) && + (!url.toLowerCase().endsWith("iso.gz"))) { + throw new InvalidParameterValueException("Please specify a valid iso"); + } + UriUtils.validateUrl(url); profile.setUrl(url); // Check that the resource limit for secondary storage won't be exceeded