mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Fix incorrect rule selection when deleting rules with same long URL
This commit is contained in:
parent
8751d6c315
commit
63c533fa62
@ -168,7 +168,9 @@ class RedirectRuleHandler implements RedirectRuleHandlerInterface
|
||||
{
|
||||
$choices = [];
|
||||
foreach ($currentRules as $index => $rule) {
|
||||
$choices[$rule->longUrl] = $index + 1;
|
||||
$priority = $index + 1;
|
||||
$key = sprintf('%s - %s', $priority, $rule->longUrl);
|
||||
$choices[$key] = $priority;
|
||||
}
|
||||
|
||||
$resp = $io->choice($message, array_flip($choices));
|
||||
|
@ -174,7 +174,7 @@ class RedirectRuleHandlerTest extends TestCase
|
||||
$callIndex++;
|
||||
|
||||
if ($message === 'What rule do you want to delete?') {
|
||||
return 'https://example.com/two'; // Second rule to be removed
|
||||
return '2 - https://example.com/two'; // Second rule to be removed
|
||||
}
|
||||
|
||||
// First we select remove action to trigger code branch, then save to finish execution
|
||||
@ -219,7 +219,7 @@ class RedirectRuleHandlerTest extends TestCase
|
||||
$callIndex++;
|
||||
|
||||
if ($message === 'What rule do you want to re-arrange?') {
|
||||
return 'https://example.com/two'; // Second rule to be re-arrange
|
||||
return '2 - https://example.com/two'; // Second rule to be re-arrange
|
||||
}
|
||||
|
||||
// First we select remove action to trigger code branch, then save to finish execution
|
||||
|
Loading…
Reference in New Issue
Block a user