Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(backend:files): avoid copy failures when sample documents are read-only and files are written to a CIFS share by falling back to stream copy

johaven3b734b82b8d0
diff --git a/backend/src/applications/files/services/files-manager.service.ts b/backend/src/applications/files/services/files-manager.service.ts
index d59102cb..9fe56d9b 100644
--- a/backend/src/applications/files/services/files-manager.service.ts
+++ b/backend/src/applications/files/services/files-manager.service.ts
@@ -35,6 +35,7 @@ import { FileError } from '../models/file-error'
import { LockConflict } from '../models/file-lock-error'
import {
checkFileName,
+ copyFileContent,
copyFiles,
createEmptyFile,
dirName,
@@ -244,7 +245,7 @@ export class FilesManager {
const fileExtension = path.extname(space.realPath)
if (checkDocument && fileExtension !== '.txt' && Object.values(DOCUMENT_TYPE).indexOf(fileExtension) > -1) {
const srcSample = path.join(__dirname, `${SAMPLE_PATH_WITHOUT_EXT}${fileExtension}`)
- return copyFiles(srcSample, space.realPath, false, false, false)
+ return copyFileContent(srcSample, space.realPath)
} else {
return createEmptyFile(space.realPath)
}