mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6940:Templates cannot be downloaded from URLs without
matching file extensions.
This commit is contained in:
parent
ce3550f333
commit
569e94908b
|
|
@ -16,8 +16,6 @@
|
|||
// under the License.
|
||||
package com.cloud.template;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
|
@ -130,20 +128,6 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
|
|||
public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
|
||||
TemplateProfile profile = super.prepare(cmd);
|
||||
String url = profile.getUrl();
|
||||
String path = null;
|
||||
try {
|
||||
URL str = new URL(url);
|
||||
path = str.getPath();
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new InvalidParameterValueException("Please specify a valid URL. URL:" + url + " is invalid");
|
||||
}
|
||||
|
||||
try {
|
||||
checkFormat(cmd.getFormat(), url);
|
||||
} catch (InvalidParameterValueException ex) {
|
||||
checkFormat(cmd.getFormat(), path);
|
||||
}
|
||||
|
||||
UriUtils.validateUrl(url);
|
||||
profile.setUrl(url);
|
||||
// Check that the resource limit for secondary storage won't be exceeded
|
||||
|
|
|
|||
Loading…
Reference in New Issue