Support for more special characters allowed in file names (^ + = [ ] ;

,)
This commit is contained in:
DRracer 2019-08-27 13:47:58 +02:00
parent 6aaa40b9a3
commit 11ce786aaa
2 changed files with 13 additions and 6 deletions

View File

@ -3816,9 +3816,13 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
// } // }
} }
else if (code_seen('^')) { // This prevents reading files with "^" in their names.
// nothing, this is a version line // Since it is unclear, if there is some usage of this construct,
} else if(code_seen('G')) // it will be deprecated in 3.9 alpha a possibly completely removed in the future:
// else if (code_seen('^')) {
// // nothing, this is a version line
// }
else if(code_seen('G'))
{ {
gcode_in_progress = (int)code_value(); gcode_in_progress = (int)code_value();
// printf_P(_N("BEGIN G-CODE=%u\n"), gcode_in_progress); // printf_P(_N("BEGIN G-CODE=%u\n"), gcode_in_progress);
@ -5319,7 +5323,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
// ----------------------------------- // -----------------------------------
case 23: case 23:
starpos = (strchr(strchr_pointer + 4,'*')); starpos = (strchr(strchr_pointer + 4,'*'));
if(starpos!=NULL) if(starpos!=NULL)
*(starpos)='\0'; *(starpos)='\0';
card.openFile(strchr_pointer + 4,true); card.openFile(strchr_pointer + 4,true);
break; break;

View File

@ -394,7 +394,10 @@ bool SdBaseFile::make83Name(const char* str, uint8_t* name, const char** ptr) {
i = 8; // place for extension i = 8; // place for extension
} else { } else {
// illegal FAT characters // illegal FAT characters
PGM_P p = PSTR("|<>^+=?/[];,*\"\\"); //PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
// 2019-08-27 really?
// Microsoft defines, that only a subset of these characters is not allowed.
PGM_P p = PSTR("|<>?/*\"\\");
uint8_t b; uint8_t b;
while ((b = pgm_read_byte(p++))) if (b == c) goto fail; while ((b = pgm_read_byte(p++))) if (b == c) goto fail;
// check size and only allow ASCII printable characters // check size and only allow ASCII printable characters