mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-02 23:26:44 +00:00
COMMON: Punycode more invalid characters in filenames
This commit is contained in:
parent
5288422e26
commit
1f40958a65
@ -303,9 +303,8 @@ String punycode_encodefilename(const String src) {
|
|||||||
if ((byte)src[i] == 0x81) { // In case we have our escape character present
|
if ((byte)src[i] == 0x81) { // In case we have our escape character present
|
||||||
dst += '\x81';
|
dst += '\x81';
|
||||||
dst += '\x79';
|
dst += '\x79';
|
||||||
// [\x00-\x1f\/":]
|
// Encode special symbols and non-printables
|
||||||
} else if (src[i] == '/' || src[i] == '"' || src[i] == ':' || src[i] == '*'
|
} else if (rindex("/\":*[]+|\\?%<>,;=", (byte)src[i]) || (byte)src[i] < 0x20) {
|
||||||
|| src[i] == '[' || src[i] == ']' || (byte)src[i] < 0x20) {
|
|
||||||
dst += '\x81';
|
dst += '\x81';
|
||||||
dst += (byte)src[i] + '\x80';
|
dst += (byte)src[i] + '\x80';
|
||||||
} else {
|
} else {
|
||||||
|
@ -441,8 +441,8 @@ sub encode_punycodefilename {
|
|||||||
my $decfname = shift;
|
my $decfname = shift;
|
||||||
|
|
||||||
$decfname =~ s/\x81/\x81\x79/g;
|
$decfname =~ s/\x81/\x81\x79/g;
|
||||||
# escape non-printables, '/', '"', '*', '[', ']' and ':'
|
# escape non-printables, "/"*[]:+|"
|
||||||
$decfname =~ s/([\x00-\x1f\/":\*\[\]])/\x81@{[chr(ord($1) + 0x80)]}/g;
|
$decfname =~ s/([\x00-\x1f\/":\*\[\]\+\|\\?%<>,;=])/\x81@{[chr(ord($1) + 0x80)]}/g;
|
||||||
|
|
||||||
if ($decfname =~ /[\x80-\xff]/) {
|
if ($decfname =~ /[\x80-\xff]/) {
|
||||||
$decfname = encode_punycode $decfname;
|
$decfname = encode_punycode $decfname;
|
||||||
|
Loading…
Reference in New Issue
Block a user