From b46851a993bf555ea7da32a29713254332104dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E7=9D=86?= Date: Wed, 21 Jun 2023 21:03:57 +0800 Subject: [PATCH] Change the dump file name --- lib/core/dump.py | 5 +++-- plugins/generic/entries.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index 2e3cdfde6..f5ba0b599 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -58,6 +58,7 @@ from lib.core.settings import WINDOWS_RESERVED_NAMES from lib.utils.safe2bin import safechardecode from thirdparty import six from thirdparty.magic import magic +from plugins.generic.entries import G_column_name_list class Dump(object): """ @@ -449,7 +450,7 @@ class Dump(object): dumpDbPath = tempDir - dumpFileName = conf.dumpFile or os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))) + dumpFileName = conf.dumpFile or os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s-%s.%s" % (unsafeSQLIdentificatorNaming(table),G_column_name_list[0],conf.dumpFormat.lower()))) if not checkFile(dumpFileName, False): try: openFile(dumpFileName, "w+b").close() @@ -470,7 +471,7 @@ class Dump(object): if not appendToFile: count = 1 while True: - candidate = "%s.%d" % (dumpFileName, count) + candidate = "%s-%02d.csv" % (dumpFileName.split('.csv')[0], count) if not checkFile(candidate, False): try: shutil.copyfile(dumpFileName, candidate) diff --git a/plugins/generic/entries.py b/plugins/generic/entries.py index 84b1c0e03..259223339 100644 --- a/plugins/generic/entries.py +++ b/plugins/generic/entries.py @@ -52,6 +52,7 @@ from lib.utils.pivotdumptable import pivotDumpTable from thirdparty import six from thirdparty.six.moves import zip as _zip +G_column_name_list=[''] class Entries(object): """ This class defines entries' enumeration functionalities for plugins. @@ -167,6 +168,7 @@ class Entries(object): infoMsg = "fetching entries" if conf.col: infoMsg += " of column(s) '%s'" % colNames + G_column_name_list[0] = colString infoMsg += " for table '%s'" % unsafeSQLIdentificatorNaming(tbl) if METADB_SUFFIX not in conf.db: infoMsg += " in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)