%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
my $name = qr{[\w.-]+};
my $list = '(?:(?:\d+-)?\d+,)*(?:\d+-)?\d+';
-my $label = '[a-zA-Z0-9@_.+-]+';
+my $label = '[^,\\/]+';
my $field = RT::Interface::REST->field_spec;
my $labels = "(?:$label,)*$label";
if (my ($type, $oids, $extra) =
($id =~ m#^($name)/($list|$labels)(?:(/.*))?$#o))
{
- $extra ||= '';
- my ($attr, $args) = $extra =~ m{^(?:/($name)(?:/(.*))?)?$}o;
- my $tids;
- if ($attr and $attr eq 'history' and $args) {
- ($tids) = $args =~ m#id/(\d.*)#o;
- }
- # expand transaction and attachment range specifications
- # (if applicable)
- foreach my $oid (expand_list($oids)) {
- if ($tids) {
- push(@objects, "$type/$oid/$attr/id/$_") for expand_list($tids);
- } else {
- push(@objects, "$type/$oid$extra");
- }
- }
- }
+ $extra ||= '';
+ my ($attr, $args) = $extra =~ m{^(?:/($name)(?:/(.*))?)?$}o;
+ my $tids;
+ if ($attr and $attr eq 'history' and $args) {
+ ($tids) = $args =~ m#id/(\d.*)#o;
+ }
+ # expand transaction and attachment range specifications
+ # (if applicable)
+ foreach my $oid (expand_list($oids)) {
+ if ($tids) {
+ push(@objects, "$type/$oid/$attr/id/$_") for expand_list($tids);
+ } else {
+ push(@objects, "$type/$oid$extra");
+ }
+ }
+ }
else {
$status = "400 Bad Request";
$output = "Invalid object ID specified: '$id'";
$handler = "Forms/$type/$attr";
unless ($m->comp_exists($handler)) {
- $args = "$attr/$args";
+ $args = defined $args ? "$attr/$args" : $attr;
$handler = "Forms/$type/default";
unless ($m->comp_exists($handler)) {