# adjust uri format
if device_details['uri'] and not device_details['uri'].startswith('/'):
device_details['uri'] = '/' + device_details['uri']
- while device_details['uri'] and device_details['uri'].endswith('/'):
- device_details['uri'] = device_details['uri'][:-1]
camera_id, camera_config = config.add_camera(device_details)
camera_config['@id'] = camera_id
}
else if (deviceSelect.val() == 'netcam') {
usernameEntry.removeAttr('readonly');
+
+ /* make sure there is one trailing slash so that
+ * an URI can be detected */
+ var url = urlEntry.val().trim();
+ var m = url.match(new RegExp('/', 'g'));
+ if (m && m.length < 3 && !url.endsWith('/')) {
+ urlEntry.val(url + '/');
+ }
+
content.find('tr.netcam').css('display', 'table-row');
addCameraSelect.hide();
}
port = parts[1];
}
- if (uri == '/') {
- uri = '';
+ if (uri == '') {
+ uri = '/';
}
return {