mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
fix(export): enforce english type folders for layout A
This commit is contained in:
@@ -1818,6 +1818,18 @@ class ExportService {
|
|||||||
const exportMediaEnabled = options.exportMedia === true &&
|
const exportMediaEnabled = options.exportMedia === true &&
|
||||||
Boolean(options.exportImages || options.exportVoices || options.exportVideos || options.exportEmojis)
|
Boolean(options.exportImages || options.exportVoices || options.exportVideos || options.exportEmojis)
|
||||||
const outputDir = path.dirname(outputPath)
|
const outputDir = path.dirname(outputPath)
|
||||||
|
const rawWriteLayout = this.configService.get('exportWriteLayout')
|
||||||
|
const writeLayout = rawWriteLayout === 'A' || rawWriteLayout === 'B' || rawWriteLayout === 'C'
|
||||||
|
? rawWriteLayout
|
||||||
|
: 'A'
|
||||||
|
// A: type-first layout, text exports are placed under `texts/`, media is placed at sibling type directories.
|
||||||
|
if (writeLayout === 'A' && path.basename(outputDir) === 'texts') {
|
||||||
|
return {
|
||||||
|
exportMediaEnabled,
|
||||||
|
mediaRootDir: outputDir,
|
||||||
|
mediaRelativePrefix: '..'
|
||||||
|
}
|
||||||
|
}
|
||||||
const outputBaseName = path.basename(outputPath, path.extname(outputPath))
|
const outputBaseName = path.basename(outputPath, path.extname(outputPath))
|
||||||
const useSharedMediaLayout = options.sessionLayout === 'shared'
|
const useSharedMediaLayout = options.sessionLayout === 'shared'
|
||||||
const mediaRelativePrefix = useSharedMediaLayout
|
const mediaRelativePrefix = useSharedMediaLayout
|
||||||
@@ -4809,9 +4821,8 @@ class ExportService {
|
|||||||
const writeLayout = rawWriteLayout === 'A' || rawWriteLayout === 'B' || rawWriteLayout === 'C'
|
const writeLayout = rawWriteLayout === 'A' || rawWriteLayout === 'B' || rawWriteLayout === 'C'
|
||||||
? rawWriteLayout
|
? rawWriteLayout
|
||||||
: 'A'
|
: 'A'
|
||||||
const shouldUseTextTypeDir = writeLayout === 'A' && !exportMediaEnabled
|
const exportBaseDir = writeLayout === 'A'
|
||||||
const exportBaseDir = shouldUseTextTypeDir
|
? path.join(outputDir, 'texts')
|
||||||
? path.join(outputDir, '聊天文本')
|
|
||||||
: outputDir
|
: outputDir
|
||||||
if (!fs.existsSync(exportBaseDir)) {
|
if (!fs.existsSync(exportBaseDir)) {
|
||||||
fs.mkdirSync(exportBaseDir, { recursive: true })
|
fs.mkdirSync(exportBaseDir, { recursive: true })
|
||||||
|
|||||||
Reference in New Issue
Block a user