mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Revert "CLOUDSTACK-6940:Templates cannot be downloaded from URLs without"
This reverts commit 569e94908b6fa471f2f72578e1ff21f3fa7c6a4e.
This commit is contained in:
parent
af37743045
commit
a8316de725
@ -16,6 +16,8 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.template;
|
package com.cloud.template;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -122,6 +124,20 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
|
|||||||
public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
|
public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
|
||||||
TemplateProfile profile = super.prepare(cmd);
|
TemplateProfile profile = super.prepare(cmd);
|
||||||
String url = profile.getUrl();
|
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);
|
UriUtils.validateUrl(url);
|
||||||
profile.setUrl(url);
|
profile.setUrl(url);
|
||||||
// Check that the resource limit for secondary storage won't be exceeded
|
// Check that the resource limit for secondary storage won't be exceeded
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user