summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/common.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index b224cbfb4..99fba8fef 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -17,6 +17,7 @@
import re
from nova import exception
+from urlparse import urlparse
from webob import exc
import webob.exc
@@ -78,7 +79,7 @@ def get_image_id_from_image_hash(image_service, context, image_hash):
def get_id_from_href(href):
- m = re.match(r'http.+/.+/(\d)+$', href)
- if not m:
+ try:
+ return int(urlparse(href).path.split('/')[-1])
+ except:
raise exc.HTTPBadRequest(_('could not parse id from href'))
- return int(m.group(1))