mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Add configurable file/dir perms and UMASK support
Introduce file and directory permission settings (fileChmod, dirChmod) end-to-end. UI: new controls in Paths settings with octal validation and defaults (664/775). API: GET exposes defaults; PUT validates octal strings and upserts configuration keys (file_chmod, dir_chmod) and clears related cache keys. Runtime: read config values in file utilities and services (FileOrganizer, direct-download, chapter-merger, epub-fixer) to apply mkdir modes and chmod files/dirs; FileOrganizer now accepts fileMode/dirMode and getFileOrganizer reads/parses DB settings. Docker: add UMASK option to docker-compose and propagate/apply UMASK in entrypoint/app-start scripts. Tests: update mocks to account for config service usage.
This commit is contained in:
@@ -289,8 +289,11 @@ async function downloadFileWithProgress(
|
||||
logger: RMABLogger
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
// Ensure target directory exists
|
||||
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
||||
// Ensure target directory exists with configured permissions
|
||||
const configService = getConfigService();
|
||||
const dirChmodStr = await configService.get('dir_chmod') || '775';
|
||||
const dirMode = parseInt(dirChmodStr, 8);
|
||||
await fs.mkdir(path.dirname(targetPath), { recursive: true, mode: dirMode });
|
||||
|
||||
// Start download with axios streaming
|
||||
const response = await axios({
|
||||
|
||||
Reference in New Issue
Block a user