4646from lib .core .settings import MIN_BINARY_DISK_DUMP_SIZE
4747from lib .core .settings import TRIM_STDOUT_DUMP_SIZE
4848from lib .core .settings import UNICODE_ENCODING
49+ from lib .core .settings import UNSAFE_DUMP_FILEPATH_REPLACEMENT
4950from lib .core .settings import WINDOWS_RESERVED_NAMES
5051from thirdparty .magic import magic
5152
@@ -418,7 +419,7 @@ def dbTableValues(self, tableValues):
418419 except :
419420 warnFile = True
420421
421- _ = unicodeencode (re .sub (r"[^\w]" , "_" , unsafeSQLIdentificatorNaming (db )))
422+ _ = unicodeencode (re .sub (r"[^\w]" , UNSAFE_DUMP_FILEPATH_REPLACEMENT , unsafeSQLIdentificatorNaming (db )))
422423 dumpDbPath = os .path .join (conf .dumpPath , "%s-%s" % (_ , hashlib .md5 (unicodeencode (db )).hexdigest ()[:8 ]))
423424
424425 if not os .path .isdir (dumpDbPath ):
@@ -441,7 +442,7 @@ def dbTableValues(self, tableValues):
441442
442443 dumpDbPath = tempDir
443444
444- dumpFileName = os .path .join (dumpDbPath , "%s.%s" % (unsafeSQLIdentificatorNaming (table ), conf .dumpFormat .lower ()))
445+ dumpFileName = os .path .join (dumpDbPath , re . sub ( r'[\\/]' , UNSAFE_DUMP_FILEPATH_REPLACEMENT , "%s.%s" % (unsafeSQLIdentificatorNaming (table ), conf .dumpFormat .lower () )))
445446 if not checkFile (dumpFileName , False ):
446447 try :
447448 openFile (dumpFileName , "w+b" ).close ()
@@ -450,9 +451,9 @@ def dbTableValues(self, tableValues):
450451 except :
451452 warnFile = True
452453
453- _ = re .sub (r"[^\w]" , "_" , normalizeUnicode (unsafeSQLIdentificatorNaming (table )))
454+ _ = re .sub (r"[^\w]" , UNSAFE_DUMP_FILEPATH_REPLACEMENT , normalizeUnicode (unsafeSQLIdentificatorNaming (table )))
454455 if len (_ ) < len (table ) or IS_WIN and table .upper () in WINDOWS_RESERVED_NAMES :
455- _ = unicodeencode (re .sub (r"[^\w]" , "_" , unsafeSQLIdentificatorNaming (table )))
456+ _ = unicodeencode (re .sub (r"[^\w]" , UNSAFE_DUMP_FILEPATH_REPLACEMENT , unsafeSQLIdentificatorNaming (table )))
456457 dumpFileName = os .path .join (dumpDbPath , "%s-%s.%s" % (_ , hashlib .md5 (unicodeencode (table )).hexdigest ()[:8 ], conf .dumpFormat .lower ()))
457458 else :
458459 dumpFileName = os .path .join (dumpDbPath , "%s.%s" % (_ , conf .dumpFormat .lower ()))
@@ -613,7 +614,7 @@ def dbTableValues(self, tableValues):
613614 if not os .path .isdir (dumpDbPath ):
614615 os .makedirs (dumpDbPath , 0755 )
615616
616- _ = re .sub (r"[^\w]" , "_" , normalizeUnicode (unsafeSQLIdentificatorNaming (column )))
617+ _ = re .sub (r"[^\w]" , UNSAFE_DUMP_FILEPATH_REPLACEMENT , normalizeUnicode (unsafeSQLIdentificatorNaming (column )))
617618 filepath = os .path .join (dumpDbPath , "%s-%d.bin" % (_ , randomInt (8 )))
618619 warnMsg = "writing binary ('%s') content to file '%s' " % (mimetype , filepath )
619620 logger .warn (warnMsg )
0 commit comments