Skip to content

Commit bbcb266

Browse files
committed
Additional debug logging
1 parent 04864f6 commit bbcb266

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

resources/processes/volume-server-script.mjs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ const copyHandler = (toVolume) => async (req, res) => {
3030
await Promise.all(
3131
files.map(async (file) => {
3232
const { sourcePath, targetPath } = file
33-
// Normalize paths to POSIX format for consistent handling across platforms
34-
// Handle Windows backslashes and mixed path separators
35-
const normalizedSourcePath = sourcePath.replace(/\\/g, '/')
36-
const sourceFolder = dirname(normalizedSourcePath)
37-
const sourceFileName = basename(normalizedSourcePath)
33+
34+
const sourceFolder = dirname(sourcePath)
35+
const sourceFileName = basename(sourcePath)
3836
const targetDir = path.posix.join(pluginFolderName, targetPath)
3937

4038
let command
@@ -59,7 +57,9 @@ const copyHandler = (toVolume) => async (req, res) => {
5957
)
6058
res.status(200).send('Files copied successfully.')
6159
} catch (error) {
62-
res.status(500).send(`Error copying files: ${error}`)
60+
res.status(500).send(
61+
`Error copying files: ${error} from ${sourceFolder}, ${sourceFileName} to ${targetDir} on ${volumeName}`
62+
)
6363
}
6464
}
6565

@@ -107,7 +107,6 @@ function copyFileToVolumeCommand(sourceFolder, fileName, volumeName, destFolder)
107107
const destFile = path.posix.join(newDestFolder, fileName)
108108

109109
// Construct the Docker command
110-
// Handle Windows paths with drive letters (e.g., /D/path) for WSL/Docker Desktop
111110
const command = `
112111
docker run --rm -v "${sourceFolder}":/host -v ${volumeName}:/volume -w /host alpine sh -c "
113112
mkdir -p '${newDestFolder}' && cp -r '${innerFilePath}' '${destFile}'"

0 commit comments

Comments
 (0)