mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-27 08:46:44 +03:00
Bugfix: sieve undefined args[i-1]
This commit is contained in:
parent
e6ea47e75f
commit
882c0bde42
8 changed files with 17 additions and 17 deletions
|
|
@ -32,7 +32,7 @@ export class ConditionalCommand extends ControlCommand
|
|||
public function pushArguments(array $args): void
|
||||
{
|
||||
args.forEach((arg, i) => {
|
||||
if (':' === args[i-1][0]) {
|
||||
if (i && ':' === args[i-1][0]) {
|
||||
this[args[i-1].replace(':','_')].value = arg.value;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export class AddressTest extends TestCommand
|
|||
this.mime = true;
|
||||
} else if (':anychild' === arg) {
|
||||
this.anychild = true;
|
||||
} else if (':index' === args[i-1]) {
|
||||
} else if (i && ':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
}
|
||||
});
|
||||
|
|
@ -205,7 +205,7 @@ export class ExistsTest extends TestCommand
|
|||
if (':mime' === arg) {
|
||||
this.mime = true;
|
||||
} else if (':anychild' === arg) {
|
||||
this.mime = true;
|
||||
this.anychild = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -294,7 +294,7 @@ export class HeaderTest extends TestCommand
|
|||
this.address_part = arg;
|
||||
} else if (':last' === arg) {
|
||||
this.last = true;
|
||||
} else if (':index' === args[i-1]) {
|
||||
} else if (i && ':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export class BodyTest extends TestCommand
|
|||
if (':raw' === arg || ':text' === arg) {
|
||||
this.body_transform = arg;
|
||||
} else if (arg instanceof GrammarStringList || arg instanceof GrammarString) {
|
||||
if (':content' === args[i-1]) {
|
||||
if (i && ':content' === args[i-1]) {
|
||||
this.body_transform = ':content ' + arg;
|
||||
} else {
|
||||
this[args[i+1] ? 'content_list' : 'key_list'] = arg;
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ export class VacationCommand extends ActionCommand
|
|||
args.forEach((arg, i) => {
|
||||
if (':mime' === arg) {
|
||||
this.mime = true;
|
||||
} else if (':addresses' === args[i-1]) {
|
||||
} else if (i && ':addresses' === args[i-1]) {
|
||||
this.addresses = arg; // GrammarStringList
|
||||
} else if (':' === args[i-1][0]) {
|
||||
} else if (i && ':' === args[i-1][0]) {
|
||||
// :days, :seconds, :subject, :from, :handle
|
||||
this[args[i-1].replace(':','_')].value = arg.value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ export class DateTest extends TestCommand
|
|||
this.originalzone = true;
|
||||
} else if (':last' === arg) {
|
||||
this.last = true;
|
||||
} else if (':zone' === args[i-1]) {
|
||||
} else if (i && ':zone' === args[i-1]) {
|
||||
this.zone.value = arg.value;
|
||||
} else if (':index' === args[i-1]) {
|
||||
} else if (i && ':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
}
|
||||
});
|
||||
|
|
@ -85,7 +85,7 @@ export class CurrentDateTest extends TestCommand
|
|||
this.key_list = args.pop();
|
||||
this.date_part = args.pop();
|
||||
args.forEach((arg, i) => {
|
||||
if (':zone' === args[i-1]) {
|
||||
if (i && ':zone' === args[i-1]) {
|
||||
this.zone.value = arg.value;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ export class DeleteHeaderCommand extends ActionCommand
|
|||
args.forEach((arg, i) => {
|
||||
if (':last' === arg) {
|
||||
this.last = true;
|
||||
} else if (':index' === args[i-1]) {
|
||||
} else if (i && ':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
args[i] = null;
|
||||
}
|
||||
});
|
||||
|
||||
if (args[l-1] instanceof GrammarString) {
|
||||
if (l && args[l-1] instanceof GrammarString) {
|
||||
this.field_name = args[l-1];
|
||||
this.value_patterns = args[l];
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ export class NotifyCommand extends ActionCommand
|
|||
{
|
||||
this._method.value = args.pop().value; // GrammarQuotedString
|
||||
args.forEach((arg, i) => {
|
||||
if (':options' === args[i-1]) {
|
||||
if (i && ':options' === args[i-1]) {
|
||||
this.options = arg; // GrammarStringList
|
||||
} else if (':' === args[i-1][0]) {
|
||||
} else if (i && ':' === args[i-1][0]) {
|
||||
// :from, :importance, :message
|
||||
this[args[i-1].replace(':','_')].value = arg.value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export class ReplaceCommand extends ActionCommand
|
|||
args.forEach((arg, i) => {
|
||||
if (':mime' === arg) {
|
||||
this.mime = true;
|
||||
} else if (':' === args[i-1][0]) {
|
||||
} else if (i && ':' === args[i-1][0]) {
|
||||
// :subject, :from
|
||||
this[args[i-1].replace(':','_')].value = arg.value;
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ export class EncloseCommand extends ActionCommand
|
|||
pushArguments(args)
|
||||
{
|
||||
args.forEach((arg, i) => {
|
||||
if (':' === args[i-1][0]) {
|
||||
if (i && ':' === args[i-1][0]) {
|
||||
// :subject, :headers
|
||||
this[args[i-1].replace(':','_')].value = arg.value;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ export class ExtractTextCommand extends ActionCommand
|
|||
args.includes(modifier) && this.modifiers.push(modifier);
|
||||
});
|
||||
args.forEach((arg, i) => {
|
||||
if (':' === args[i-1][0]) {
|
||||
if (i && ':' === args[i-1][0]) {
|
||||
// :first
|
||||
this[args[i-1].replace(':','_')].value = arg.value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue