Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
3264df0c
Unverified
Commit
3264df0c
authored
May 21, 2021
by
IKEDA Soji
Committed by
GitHub
May 21, 2021
Browse files
Merge pull request #1167 from ikedas/obsolete-escape_chars by ikedas
Obsolete escape_chars() / unescape_chars()
parents
a5808af3
33994164
Changes
8
Show whitespace changes
Inline
Side-by-side
src/cgi/wwsympa.fcgi.in
View file @
3264df0c
...
@@ -8948,7 +8948,6 @@ sub do_remove_arc {
...
@@ -8948,7 +8948,6 @@ sub do_remove_arc {
wwslog('info', 'List %s, yyyy %s, mm %s, #message %s',
wwslog('info', 'List %s, yyyy %s, mm %s, #message %s',
$in{'list'}, $in{'yyyy'}, $in{'month'});
$in{'list'}, $in{'yyyy'}, $in{'month'});
# $in{'msgid'} = Sympa::Tools::Text::unescape_chars($in{'msgid'});
my @msgids = split /\0/, $in{'msgid'};
my @msgids = split /\0/, $in{'msgid'};
my @msg_subjects = split /\0/, $in{'msg_subject'};
my @msg_subjects = split /\0/, $in{'msg_subject'};
...
@@ -9467,7 +9466,6 @@ sub do_arcsearch_id {
...
@@ -9467,7 +9466,6 @@ sub do_arcsearch_id {
return undef;
return undef;
}
}
#$in{'msgid'} = Sympa::Tools::Text::unescape_chars($in{'msgid'});
$param->{'msgid'} = $in{'msgid'};
$param->{'msgid'} = $in{'msgid'};
$search->limit(1);
$search->limit(1);
...
@@ -10073,10 +10071,11 @@ sub do_viewbounce {
...
@@ -10073,10 +10071,11 @@ sub do_viewbounce {
my $html_relpath;
my $html_relpath;
if ($in{'email'}) {
if ($in{'email'}) {
my $escaped_email = Sympa::Tools::Text::escape_chars($in{'email'});
my $escaped_email =
Sympa::Tools::Text::encode_filesystem_safe($in{'email'});
$html_relpath =
$html_relpath =
$in{'envid'}
$in{'envid'}
? sprintf('%s_%08s', $escaped_email, $in{'envid'})
? sprintf('%s_
_
%08s', $escaped_email, $in{'envid'})
: $escaped_email;
: $escaped_email;
} elsif ($in{'dir'} and $in{'file'}) {
} elsif ($in{'dir'} and $in{'file'}) {
$html_relpath = $in{'dir'};
$html_relpath = $in{'dir'};
...
@@ -10310,7 +10309,8 @@ sub do_resetbounce {
...
@@ -10310,7 +10309,8 @@ sub do_resetbounce {
foreach my $email (@emails) {
foreach my $email (@emails) {
my $escaped_email = Sympa::Tools::Text::escape_chars($email);
my $escaped_email =
Sympa::Tools::Text::encode_filesystem_safe($email);
unless ($list->is_list_member($email)) {
unless ($list->is_list_member($email)) {
Sympa::WWW::Report::reject_report_web('user',
Sympa::WWW::Report::reject_report_web('user',
...
...
src/lib/Sympa/Archive.pm
View file @
3264df0c
...
@@ -405,14 +405,6 @@ sub html_remove {
...
@@ -405,14 +405,6 @@ sub html_remove {
'
-rmm
'
=>
$msgid
'
-rmm
'
=>
$msgid
);
);
# Remomve urlized message.
my
$url_dir
=
$list
->
{'
dir
'}
.
'
/urlized/
'
.
Sympa::Tools::Text::
escape_chars
(
$msgid
);
my
$error
;
File::Path::
remove_tree
(
$url_dir
,
{
error
=>
\
$error
});
return
1
;
return
1
;
}
}
...
...
src/lib/Sympa/List.pm
View file @
3264df0c
...
@@ -1208,37 +1208,6 @@ sub get_recipients_per_mode {
...
@@ -1208,37 +1208,6 @@ sub get_recipients_per_mode {
next
;
next
;
}
}
#XXX Following will be done by ProcessOutgoing spindle.
# # Message should be re-encrypted, however, user certificate is
# # missing.
# if ($message->{'smime_crypted'}
# and not -r $Conf::Conf{'ssl_cert_dir'} . '/'
# . Sympa::Tools::Text::escape_chars($user->{'email'})
# and not -r $Conf::Conf{'ssl_cert_dir'} . '/'
# . Sympa::Tools::Text::escape_chars($user->{'email'} . '@enc')) {
# my $subject = $message->{'decoded_subject'};
# my $sender = $message->{'sender'};
# unless (
# Sympa::send_file(
# $self,
# 'x509-user-cert-missing',
# $user->{'email'},
# { 'mail' =>
# {'subject' => $subject, 'sender' => $sender},
# 'auto_submitted' => 'auto-generated'
# }
# )
# ) {
# $log->syslog(
# 'notice',
# 'Unable to send template "x509-user-cert-missing" to %s',
# $user->{'email'}
# );
# }
# next;
# }
# # Otherwise it may be shelved encryption.
if
(
$user
->
{'
reception
'}
eq
'
txt
')
{
if
(
$user
->
{'
reception
'}
eq
'
txt
')
{
if
(
$user
->
{'
bounce_address
'})
{
if
(
$user
->
{'
bounce_address
'})
{
push
@tabrcpt_txt_verp
,
$user
->
{'
email
'};
push
@tabrcpt_txt_verp
,
$user
->
{'
email
'};
...
...
src/lib/Sympa/Message.pm
View file @
3264df0c
...
@@ -1117,9 +1117,9 @@ sub smime_encrypt {
...
@@ -1117,9 +1117,9 @@ sub smime_encrypt {
my
$certfile
;
my
$certfile
;
my
$entity
;
my
$entity
;
my
$base
=
my
$base
=
sprintf
'
%s/%s
',
$
Conf::
Conf
{'
ssl_cert_dir
'}
.
'
/
'
$
Conf::
Conf
{'
ssl_cert_dir
'}
,
.
Sympa::Tools::Text::
e
scape_chars
(
$email
);
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
$email
);
if
(
-
f
$base
.
'
@enc
')
{
if
(
-
f
$base
.
'
@enc
')
{
$certfile
=
$base
.
'
@enc
';
$certfile
=
$base
.
'
@enc
';
}
else
{
}
else
{
...
@@ -1353,8 +1353,8 @@ sub check_smime_signature {
...
@@ -1353,8 +1353,8 @@ sub check_smime_signature {
# or a pair of single-purpose. save them, as email@addr if combined,
# or a pair of single-purpose. save them, as email@addr if combined,
# or as email@addr@sign / email@addr@enc for split certs.
# or as email@addr@sign / email@addr@enc for split certs.
foreach
my
$c
(
keys
%certs
)
{
foreach
my
$c
(
keys
%certs
)
{
my
$filename
=
"
$Conf
::Conf{ssl_cert_dir}
/
"
my
$filename
=
sprintf
'
%s/%s
',
$
Conf::
Conf
{
ssl_cert_dir
}
,
.
Sympa::Tools::Text::
e
scape_chars
(
lc
(
$sender
)
)
;
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
lc
$sender
);
if
(
$c
ne
'
both
')
{
if
(
$c
ne
'
both
')
{
unlink
$filename
;
# just in case there's an old cert left...
unlink
$filename
;
# just in case there's an old cert left...
$filename
.=
"
\@
$c
";
$filename
.=
"
\@
$c
";
...
...
src/lib/Sympa/Spindle/ProcessTask.pm
View file @
3264df0c
...
@@ -911,8 +911,11 @@ sub do_purge_orphan_bounces {
...
@@ -911,8 +911,11 @@ sub do_purge_orphan_bounces {
$user_ref
;
$user_ref
;
$user_ref
=
$list
->
get_next_bouncing_list_member
()
$user_ref
=
$list
->
get_next_bouncing_list_member
()
)
{
)
{
my
$user_id
=
$user_ref
->
{'
email
'};
$bounced_users
{
$bounced_users
{
Sympa::Tools::Text::
escape_chars
(
$user_id
)}
=
1
;
Sympa::Tools::Text::
encode_filesystem_safe
(
$user_ref
->
{
email
}
)
}
=
1
;
}
}
my
$bounce_dir
=
$list
->
get_bounce_dir
();
my
$bounce_dir
=
$list
->
get_bounce_dir
();
...
@@ -935,10 +938,10 @@ sub do_purge_orphan_bounces {
...
@@ -935,10 +938,10 @@ sub do_purge_orphan_bounces {
while
(
$marshalled
=
readdir
$dh
)
{
while
(
$marshalled
=
readdir
$dh
)
{
my
$metadata
=
my
$metadata
=
Sympa::Spool::
unmarshal_metadata
(
$bounce_dir
,
$marshalled
,
Sympa::Spool::
unmarshal_metadata
(
$bounce_dir
,
$marshalled
,
qr/\A([^\s\@]+\@[\w\.\-*]+?)(?:_(\w+))?\z/
,
qr/\A([^\s\@]+\@[\w\.\-*]+?)(?:_
_
(\w+))?\z/
,
[
qw(recipient envid)
]);
[
qw(recipient envid)
]);
next
unless
$metadata
;
next
unless
$metadata
;
# Skip <email>_<envid> which is used by tracking feature.
# Skip <email>_
_
<envid> which is used by tracking feature.
next
if
defined
$metadata
->
{
envid
};
next
if
defined
$metadata
->
{
envid
};
unless
(
$bounced_users
{
$marshalled
})
{
unless
(
$bounced_users
{
$marshalled
})
{
...
@@ -1014,7 +1017,8 @@ sub do_expire_bounce {
...
@@ -1014,7 +1017,8 @@ sub do_expire_bounce {
$email
);
$email
);
next
;
next
;
}
}
my
$escaped_email
=
Sympa::Tools::Text::
escape_chars
(
$email
);
my
$escaped_email
=
Sympa::Tools::Text::
encode_filesystem_safe
(
$email
);
my
$bounce_dir
=
$list
->
get_bounce_dir
();
my
$bounce_dir
=
$list
->
get_bounce_dir
();
...
...
src/lib/Sympa/Tools/Text.pm
View file @
3264df0c
...
@@ -249,32 +249,8 @@ sub encode_uri {
...
@@ -249,32 +249,8 @@ sub encode_uri {
}
}
# Old name: tools::escape_chars().
# Old name: tools::escape_chars().
sub
escape_chars
{
# Moved to: Sympa::Upgrade::_escape_chars()
my
$s
=
shift
;
#sub escape_chars;
my
$except
=
shift
;
## Exceptions
my
$ord_except
=
ord
$except
if
defined
$except
;
## Escape chars
## !"#$%&'()+,:;<=>?[] AND accented chars
## escape % first
foreach
my
$i
(
0x25
,
0x20
..
0x24
,
0x26
..
0x2c
,
0x3a
..
0x3f
,
0x5b
,
0x5d
,
0x80
..
0x9f
,
0xa0
..
0xff
)
{
next
if
defined
$ord_except
and
$i
==
$ord_except
;
my
$hex_i
=
sprintf
"
%lx
",
$i
;
$s
=~
s/\x$hex_i/%$hex_i/g
;
}
## Special traetment for '/'
$s
=~
s/\//%a5/g
unless
defined
$except
and
$except
eq
'
/
';
return
$s
;
}
# Old name: tt2::escape_url().
# Old name: tt2::escape_url().
# DEPRECATED. Use Sympa::Tools::Text::escape_uri() or
# DEPRECATED. Use Sympa::Tools::Text::escape_uri() or
...
@@ -539,19 +515,8 @@ sub _gc_length {
...
@@ -539,19 +515,8 @@ sub _gc_length {
}
}
# Old name: tools::unescape_chars().
# Old name: tools::unescape_chars().
sub
unescape_chars
{
# Moved to: Sympa::Upgrade::_unescape_chars().
my
$s
=
shift
;
#sub unescape_chars;
$s
=~
s/%a5/\//g
;
## Special traetment for '/'
foreach
my
$i
(
0x20
..
0x2c
,
0x3a
..
0x3f
,
0x5b
,
0x5d
,
0x80
..
0x9f
,
0xa0
..
0xff
)
{
my
$hex_i
=
sprintf
"
%lx
",
$i
;
my
$hex_s
=
sprintf
"
%c
",
$i
;
$s
=~
s/%$hex_i/$hex_s/g
;
}
return
$s
;
}
# Old name: tools::valid_email().
# Old name: tools::valid_email().
sub
valid_email
{
sub
valid_email
{
...
@@ -770,10 +735,10 @@ Encoded string, stripped C<utf8> flag if any.
...
@@ -770,10 +735,10 @@ Encoded string, stripped C<utf8> flag if any.
=item escape_chars ( $str )
=item escape_chars ( $str )
Escape weird characters.
B<Deprecated>.
Use L</encode_filesystem_safe>.
ToDo: This should be obsoleted in the future release: Would be better to use
Escape weird characters.
L</encode_filesystem_safe>.
=item escape_url ( $str )
=item escape_url ( $str )
...
@@ -906,10 +871,10 @@ C<$file> is the path to text file.
...
@@ -906,10 +871,10 @@ C<$file> is the path to text file.
=item unescape_chars ( $str )
=item unescape_chars ( $str )
Unescape weird characters.
B<Deprecated>.
Use L</decode_filesystem_safe>.
ToDo: This should be obsoleted in the future release: Would be better to use
Unescape weird characters.
L</decode_filesystem_safe>.
=item valid_email ( $string )
=item valid_email ( $string )
...
...
src/lib/Sympa/Tracking.pm
View file @
3264df0c
...
@@ -264,8 +264,8 @@ sub store {
...
@@ -264,8 +264,8 @@ sub store {
unless
(
_db_insert_notification
(
$rcpt
,
%options
))
{
unless
(
_db_insert_notification
(
$rcpt
,
%options
))
{
return
undef
;
return
undef
;
}
}
$filename
=
sprintf
'
%s_%08s
',
$filename
=
sprintf
'
%s_
_
%08s
',
Sympa::Tools::Text::
e
scape_chars
(
$rcpt
),
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
$rcpt
),
$options
{
envid
};
$options
{
envid
};
}
else
{
}
else
{
unless
(
unless
(
...
@@ -275,7 +275,7 @@ sub store {
...
@@ -275,7 +275,7 @@ sub store {
$rcpt
,
$self
->
{
context
});
$rcpt
,
$self
->
{
context
});
return
undef
;
return
undef
;
}
}
$filename
=
Sympa::Tools::Text::
e
scape_chars
(
$rcpt
);
$filename
=
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
$rcpt
);
}
}
unless
(
open
$ofh
,
'
>
',
$bounce_dir
.
'
/
'
.
$filename
)
{
unless
(
open
$ofh
,
'
>
',
$bounce_dir
.
'
/
'
.
$filename
)
{
$log
->
syslog
('
err
',
'
Unable to write %s/%s
',
$bounce_dir
,
$filename
);
$log
->
syslog
('
err
',
'
Unable to write %s/%s
',
$bounce_dir
,
$filename
);
...
@@ -479,7 +479,7 @@ sub remove_message_by_email {
...
@@ -479,7 +479,7 @@ sub remove_message_by_email {
return
undef
unless
$email
;
return
undef
unless
$email
;
my
$bounce_dir
=
$self
->
{
directory
};
my
$bounce_dir
=
$self
->
{
directory
};
my
$escaped_email
=
Sympa::Tools::Text::
e
scape_chars
(
$email
);
my
$escaped_email
=
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
$email
);
my
$ret
=
unlink
sprintf
('
%s/%s
',
$bounce_dir
,
$escaped_email
);
my
$ret
=
unlink
sprintf
('
%s/%s
',
$bounce_dir
,
$escaped_email
);
# Remove HTML view.
# Remove HTML view.
...
@@ -540,9 +540,9 @@ sub remove_message_by_id {
...
@@ -540,9 +540,9 @@ sub remove_message_by_id {
while
(
my
$info
=
$sth
->
fetchrow_hashref
('
NAME_lc
'))
{
while
(
my
$info
=
$sth
->
fetchrow_hashref
('
NAME_lc
'))
{
my
$bounce_dir
=
$self
->
{
directory
};
my
$bounce_dir
=
$self
->
{
directory
};
my
$escaped_email
=
my
$escaped_email
=
Sympa::Tools::Text::
e
scape_chars
(
$info
->
{'
recipient
'});
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
$info
->
{'
recipient
'});
my
$envid
=
$info
->
{'
envid
'};
my
$envid
=
$info
->
{'
envid
'};
unlink
sprintf
('
%s/%s_%08s
',
$bounce_dir
,
$escaped_email
,
$envid
);
unlink
sprintf
('
%s/%s_
_
%08s
',
$bounce_dir
,
$escaped_email
,
$envid
);
}
}
$sth
->
finish
;
$sth
->
finish
;
...
@@ -619,9 +619,9 @@ sub remove_message_by_period {
...
@@ -619,9 +619,9 @@ sub remove_message_by_period {
while
(
my
$info
=
$sth
->
fetchrow_hashref
('
NAME_lc
'))
{
while
(
my
$info
=
$sth
->
fetchrow_hashref
('
NAME_lc
'))
{
my
$bounce_dir
=
$self
->
{
directory
};
my
$bounce_dir
=
$self
->
{
directory
};
my
$escaped_email
=
my
$escaped_email
=
Sympa::Tools::Text::
e
scape_chars
(
$info
->
{'
recipient
'});
Sympa::Tools::Text::
e
ncode_filesystem_safe
(
$info
->
{'
recipient
'});
my
$envid
=
$info
->
{'
envid
'};
my
$envid
=
$info
->
{'
envid
'};
unlink
sprintf
('
%s/%s_%08s
',
$bounce_dir
,
$escaped_email
,
$envid
);
unlink
sprintf
('
%s/%s_
_
%08s
',
$bounce_dir
,
$escaped_email
,
$envid
);
}
}
$sth
->
finish
;
$sth
->
finish
;
...
...
src/lib/Sympa/Upgrade.pm
View file @
3264df0c
...
@@ -1366,9 +1366,12 @@ sub upgrade {
...
@@ -1366,9 +1366,12 @@ sub upgrade {
and
length
$msg_string
and
length
$msg_string
and
$recipient
)
{
and
$recipient
)
{
$msg_string
=
MIME::Base64::
decode_base64
(
$msg_string
);
$msg_string
=
MIME::Base64::
decode_base64
(
$msg_string
);
# Note: See also upgrading from versions later than 6.2b.3
# to version 6.2.63b.1 in below.
# below.
my
$bounce_path
=
sprintf
'
%s/%s_%08s
',
my
$bounce_path
=
sprintf
'
%s/%s_%08s
',
$list
->
get_bounce_dir
,
$list
->
get_bounce_dir
,
Sympa::Tools::Text::
escape_chars
(
$recipient
),
_
escape_chars
(
$recipient
),
$info
->
{'
pk_notification
'};
$info
->
{'
pk_notification
'};
if
(
open
my
$fh
,
'
>
',
$bounce_path
)
{
if
(
open
my
$fh
,
'
>
',
$bounce_path
)
{
print
$fh
$msg_string
;
print
$fh
$msg_string
;
...
@@ -2078,6 +2081,7 @@ sub upgrade {
...
@@ -2078,6 +2081,7 @@ sub upgrade {
_process_all_files
(
_process_all_files
(
'
mhonarc-ressources.tt2
',
'
mhonarc-ressources.tt2
',
sub
{
sub
{
my
$that
=
shift
;
my
$dir
=
shift
;
my
$dir
=
shift
;
my
$oldfile
=
shift
;
my
$oldfile
=
shift
;
my
$newfile
=
'
mhonarc_rc.tt2
';
my
$newfile
=
'
mhonarc_rc.tt2
';
...
@@ -2103,6 +2107,7 @@ sub upgrade {
...
@@ -2103,6 +2107,7 @@ sub upgrade {
_process_all_files
(
_process_all_files
(
'
search_filters/blacklist.txt
',
'
search_filters/blacklist.txt
',
sub
{
sub
{
my
$that
=
shift
;
my
$dir
=
shift
;
my
$dir
=
shift
;
my
$oldfile
=
shift
;
my
$oldfile
=
shift
;
my
$newfile
=
'
search_filters/blocklist.txt
';
my
$newfile
=
'
search_filters/blocklist.txt
';
...
@@ -2116,6 +2121,68 @@ sub upgrade {
...
@@ -2116,6 +2121,68 @@ sub upgrade {
$log
->
syslog
('
notice
',
'
...Done.
');
$log
->
syslog
('
notice
',
'
...Done.
');
}
}
if
(
lower_version
(
$previous_version
,
'
6.2.63b.1
'))
{
$log
->
syslog
('
notice
',
'
Moving bounce information and so on...
');
_process_all_files
(
'
config
',
sub
{
my
$that
=
shift
;
my
$dir
=
shift
;
my
$file
=
shift
;
return
unless
ref
$that
eq
'
Sympa::List
';
# Note: See also upgrading to version 6.2b.3 in above.
my
$bounce_dir
=
$that
->
get_bounce_dir
;
my
$dh
;
return
unless
-
d
$bounce_dir
and
opendir
$dh
,
$bounce_dir
;
foreach
my
$old
(
readdir
$dh
)
{
next
if
0
==
index
$old
,
'
.
';
next
unless
$old
=~
/\A(.+)(?:_(\w+))?\z/
;
my
(
$escaped_email
,
$envid
)
=
(
$
1
,
$
2
);
my
$new
;
if
(
defined
$envid
)
{
$new
=
sprintf
'
%s/%s__%08s
',
Sympa::Tools::Text::
encode_filesystem_safe
(
_unescape_chars
(
$escaped_email
)),
$envid
;
}
else
{
$new
=
Sympa::Tools::Text::
encode_filesystem_safe
(
_unescape_chars
(
$escaped_email
));
}
next
if
$old
eq
$new
;
rename
sprintf
('
%s/%s
',
$bounce_dir
,
$old
),
sprintf
('
%s/%s
',
$bounce_dir
,
$new
);
}
}
);
my
$dh
;
if
(
opendir
$dh
,
$
Conf::
Conf
{'
ssl_cert_dir
'})
{
foreach
my
$old
(
readdir
$dh
)
{
next
if
0
==
index
$old
,
'
.
';
my
(
$escaped_email
,
$ext
)
=
(
$old
=~
/\A(.+)(?:(\@\w+)?)\z/
);
my
$new
=
Sympa::Tools::Text::
encode_filesystem_safe
(
_unescape_chars
(
$escaped_email
))
.
(
$ext
//
'');
next
if
$old
eq
$new
;
rename
sprintf
('
%s/%s
',
$
Conf::
Conf
{'
ssl_cert_dir
'},
$old
),
sprintf
('
%s/%s
',
$
Conf::
Conf
{'
ssl_cert_dir
'},
$new
);
}
}
$log
->
syslog
('
notice
',
'
...Done.
');
}
return
1
;
return
1
;
}
}
...
@@ -2433,23 +2500,62 @@ sub _process_all_files {
...
@@ -2433,23 +2500,62 @@ sub _process_all_files {
my
$file
=
shift
;
my
$file
=
shift
;
my
$sub
=
shift
;
my
$sub
=
shift
;
my
@dirs
;
$sub
->
('
*
',
$
Conf::
Conf
{'
etc
'},
$file
)
push
@dirs
,
$
Conf::
Conf
{'
etc
'}
if
-
f
$
Conf::
Conf
{'
etc
'}
.
'
/
'
.
$file
;
if
-
f
$
Conf::
Conf
{'
etc
'}
.
'
/
'
.
$file
;
foreach
my
$robot
(
Sympa::List::
get_robots
())
{
foreach
my
$robot
(
Sympa::List::
get_robots
())
{
my
$dir
=
sprintf
'
%s/%s
',
$
Conf::
Conf
{'
etc
'},
$robot
;
my
$dir
=
sprintf
'
%s/%s
',
$
Conf::
Conf
{'
etc
'},
$robot
;
push
@
dir
s
,
$
dir
$sub
->
(
$robot
,
$
dir
,
$
file
)
if
-
f
$dir
.
'
/
'
.
$file
;
if
-
f
$dir
.
'
/
'
.
$file
;
foreach
my
$list
(
@
{
Sympa::List::
get_lists
(
$robot
)
||
[]
})
{
foreach
my
$list
(
@
{
Sympa::List::
get_lists
(
$robot
)
||
[]
})
{
push
@dirs
,
$list
->
{'
dir
'}
$sub
->
(
$list
,
$list
->
{'
dir
'}
,
$file
)
if
-
f
$list
->
{'
dir
'}
.
'
/
'
.
$file
;
if
-
f
$list
->
{'
dir
'}
.
'
/
'
.
$file
;
}
}
}
}
}
foreach
my
$dir
(
@dirs
)
{
# Old name: tools::escape_chars(), Sympa::Tools::Text::escape_chars().
$sub
->
(
$dir
,
$file
);
sub
_escape_chars
{
my
$s
=
shift
;
my
$except
=
shift
;
## Exceptions
my
$ord_except
=
ord
$except
if
defined
$except
;
## Escape chars
## !"#$%&'()+,:;<=>?[] AND accented chars
## escape % first
foreach
my
$i
(
0x25
,
0x20
..
0x24
,
0x26
..
0x2c
,
0x3a
..
0x3f
,
0x5b
,
0x5d
,
0x80
..
0x9f
,
0xa0
..
0xff
)
{
next
if
defined
$ord_except
and
$i
==
$ord_except
;
my
$hex_i
=
sprintf
"
%lx
",
$i
;
$s
=~
s/\x$hex_i/%$hex_i/g
;
}
## Special traetment for '/'
$s
=~
s/\//%a5/g
unless
defined
$except
and
$except
eq
'
/
';
return
$s
;
}
# Old name: tools::unescape_chars(), Sympa::Tools::Text::unescape_chars().
sub
_unescape_chars
{
my
$s
=
shift
;
$s
=~
s/%a5/\//g
;
## Special traetment for '/'
foreach
my
$i
(
0x20
..
0x2c
,
0x3a
..
0x3f
,
0x5b
,
0x5d
,
0x80
..
0x9f
,
0xa0
..
0xff
)
{
my
$hex_i
=
sprintf
"
%lx
",
$i
;
my
$hex_s
=
sprintf
"
%c
",
$i
;
$s
=~
s/%$hex_i/$hex_s/g
;
}
}
return
$s
;
}
}
1
;
1
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment