Fix:Downloader sets file permission and owner on files #286

This commit is contained in:
advplyr 2022-02-03 18:08:39 -06:00
parent 405d333d60
commit 590dbe3991
2 changed files with 8 additions and 3 deletions

View file

@ -5,16 +5,18 @@ const archiver = require('archiver')
const workerThreads = require('worker_threads')
const Logger = require('./Logger')
const Download = require('./objects/Download')
const filePerms = require('./utils/filePerms')
const { getId } = require('./utils/index')
const { writeConcatFile, writeMetadataFile } = require('./utils/ffmpegHelpers')
const { getFileSize } = require('./utils/fileUtils')
const TAG = 'DownloadManager'
class DownloadManager {
constructor(db, MetadataPath, AudiobookPath, emitter) {
constructor(db, MetadataPath, AudiobookPath, Uid, Gid) {
this.Uid = Uid
this.Gid = Gid
this.db = db
this.MetadataPath = MetadataPath
this.AudiobookPath = AudiobookPath
this.emitter = emitter
this.downloadDirPath = Path.join(this.MetadataPath, 'downloads')
@ -343,6 +345,9 @@ class DownloadManager {
return
}
// Set file permissions and ownership
await filePerms(download.fullPath, 0o774, this.Uid, this.Gid)
var filesize = await getFileSize(download.fullPath)
download.setComplete(filesize)
if (download.socket) {