mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-02 15:16:46 +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
|
||||
dst += '\x81';
|
||||
dst += '\x79';
|
||||
// [\x00-\x1f\/":]
|
||||
} else if (src[i] == '/' || src[i] == '"' || src[i] == ':' || src[i] == '*'
|
||||
|| src[i] == '[' || src[i] == ']' || (byte)src[i] < 0x20) {
|
||||
// Encode special symbols and non-printables
|
||||
} else if (rindex("/\":*[]+|\\?%<>,;=", (byte)src[i]) || (byte)src[i] < 0x20) {
|
||||
dst += '\x81';
|
||||
dst += (byte)src[i] + '\x80';
|
||||
} else {
|
||||
|
@ -441,8 +441,8 @@ sub encode_punycodefilename {
|
||||
my $decfname = shift;
|
||||
|
||||
$decfname =~ s/\x81/\x81\x79/g;
|
||||
# escape non-printables, '/', '"', '*', '[', ']' and ':'
|
||||
$decfname =~ s/([\x00-\x1f\/":\*\[\]])/\x81@{[chr(ord($1) + 0x80)]}/g;
|
||||
# escape non-printables, "/"*[]:+|"
|
||||
$decfname =~ s/([\x00-\x1f\/":\*\[\]\+\|\\?%<>,;=])/\x81@{[chr(ord($1) + 0x80)]}/g;
|
||||
|
||||
if ($decfname =~ /[\x80-\xff]/) {
|
||||
$decfname = encode_punycode $decfname;
|
||||
|
Loading…
Reference in New Issue
Block a user