Fix regex

This commit is contained in:
Gustavo Maximiliano Cortez 2017-09-09 19:23:46 -03:00
commit 0c67f02754
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 7 additions and 7 deletions

View file

@ -14,7 +14,7 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
$timeout(function() {
var form = addressbookForm;
if (data && form) {
data = data.replace(/^bitcoin[cash]*:/, '');
data = data.replace(/^bitcoin(cash)?:/, '');
form.address.$setViewValue(data);
form.address.$isValid = true;
form.address.$render();

View file

@ -69,8 +69,8 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
}, 100);
}
// data extensions for Payment Protocol with non-backwards-compatible request
if ((/^bitcoin[cash]*:\?r=[\w+]/).exec(data)) {
data = decodeURIComponent(data.replace(/bitcoin[cash]*:?r=/, ''));
if ((/^bitcoin(cash)?:\?r=[\w+]/).exec(data)) {
data = decodeURIComponent(data.replace(/bitcoin(cash)?:\?r=/, ''));
$state.go('tabs.send', {}, {
'reload': true,
'notify': $state.current.name == 'tabs.send' ? false : true
@ -85,9 +85,9 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
data = sanitizeUri(data);
// Bitcoin or Bitcoin Cash URL
if ((/^bitcoin[cash]*:/).exec(data)) {
if ((/^bitcoin(cash)?:/).exec(data)) {
var coin = 'btc';
if ((/^bitcoincash*:/).exec(data)) {
if ((/^bitcoincash:/).exec(data)) {
coin = 'bch';
data = data.replace(/bitcoincash*:/, 'bitcoin:');
}

View file

@ -57,10 +57,10 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
// This event is sent to an existent instance of Copay (only for standalone apps)
gui.App.on('open', function(pathData) {
if (pathData.indexOf(/^bitcoin[cash]*:/) != -1) {
if (pathData.indexOf(/^bitcoin(cash)?:/) != -1) {
$log.debug('Bitcoin URL found');
handleOpenURL({
url: pathData.substring(pathData.indexOf(/^bitcoin[cash]*:/))
url: pathData.substring(pathData.indexOf(/^bitcoin(cash)?:/))
});
} else if (pathData.indexOf(appConfigService.name + '://') != -1) {
$log.debug(appConfigService.name + ' URL found');