fix folder permissions in donetorrentactions
This commit is contained in:
@@ -46,7 +46,7 @@ func MoveAndLeaveSymlink(config Settings.FullClientSettings, tHash string, db *s
|
|||||||
}
|
}
|
||||||
_, err = os.Stat(tStorage.StoragePath)
|
_, err = os.Stat(tStorage.StoragePath)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
err := os.MkdirAll(tStorage.StoragePath, 0755)
|
err := os.MkdirAll(tStorage.StoragePath, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Logger.WithFields(logrus.Fields{"New File Path": newFilePath, "error": err}).Error("Cannot create new directory")
|
Logger.WithFields(logrus.Fields{"New File Path": newFilePath, "error": err}).Error("Cannot create new directory")
|
||||||
moveDone = false
|
moveDone = false
|
||||||
@@ -62,11 +62,10 @@ func MoveAndLeaveSymlink(config Settings.FullClientSettings, tHash string, db *s
|
|||||||
|
|
||||||
if oldFilePath != newFilePath {
|
if oldFilePath != newFilePath {
|
||||||
newFilePathDir := filepath.Dir(newFilePath)
|
newFilePathDir := filepath.Dir(newFilePath)
|
||||||
os.Mkdir(newFilePathDir, 0755)
|
os.Mkdir(newFilePathDir, 0777)
|
||||||
err := folderCopy.Copy(oldFilePath, newFilePath) //copy the folder to the new location
|
err := folderCopy.Copy(oldFilePath, newFilePath) //copy the folder to the new location
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Logger.WithFields(logrus.Fields{"Old File Path": oldFilePath, "New File Path": newFilePath, "error": err}).Error("Error Copying Folder!")
|
Logger.WithFields(logrus.Fields{"Old File Path": oldFilePath, "New File Path": newFilePath, "error": err}).Error("Error Copying Folder!")
|
||||||
moveDone = false
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
os.Chmod(newFilePath, 0777)
|
os.Chmod(newFilePath, 0777)
|
||||||
|
@@ -140,7 +140,7 @@ func StartTorrent(clientTorrent *torrent.Torrent, torrentLocalStorage Storage.To
|
|||||||
allStoredTorrents := Storage.FetchAllStoredTorrents(torrentDbStorage)
|
allStoredTorrents := Storage.FetchAllStoredTorrents(torrentDbStorage)
|
||||||
for _, runningTorrentHashes := range allStoredTorrents {
|
for _, runningTorrentHashes := range allStoredTorrents {
|
||||||
if runningTorrentHashes.Hash == TempHash.String() {
|
if runningTorrentHashes.Hash == TempHash.String() {
|
||||||
Logger.WithFields(logrus.Fields{"Hash": TempHash.String()}).Error("Torrent has duplicate hash to already running torrent... will not add to storage")
|
Logger.WithFields(logrus.Fields{"Hash": TempHash.String()}).Info("Torrent has duplicate hash to already running torrent... will not add to storage")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Sto
|
|||||||
go func() { //moving torrent in separate go-routine then verifying that the data is still there and correct
|
go func() { //moving torrent in separate go-routine then verifying that the data is still there and correct
|
||||||
err := MoveAndLeaveSymlink(config, singleTorrent.InfoHash().String(), db, false, "") //can take some time to move file so running this in another thread TODO make this a goroutine and skip this block if the routine is still running
|
err := MoveAndLeaveSymlink(config, singleTorrent.InfoHash().String(), db, false, "") //can take some time to move file so running this in another thread TODO make this a goroutine and skip this block if the routine is still running
|
||||||
if err != nil { //If we fail, print the error and attempt a retry
|
if err != nil { //If we fail, print the error and attempt a retry
|
||||||
Logger.WithFields(logrus.Fields{"singleTorrent": singleTorrentFromStorage.TorrentName, "error": err}).Info("Failed to move Torrent!")
|
Logger.WithFields(logrus.Fields{"singleTorrent": singleTorrentFromStorage.TorrentName, "error": err}).Error("Failed to move Torrent!")
|
||||||
VerifyData(singleTorrent)
|
VerifyData(singleTorrent)
|
||||||
tStorage.TorrentMoved = false
|
tStorage.TorrentMoved = false
|
||||||
Storage.UpdateStorageTick(db, tStorage)
|
Storage.UpdateStorageTick(db, tStorage)
|
||||||
|
Reference in New Issue
Block a user