fix(actions): watch dir check torrent suffix (#540)

Update run.go

Make conditional for generating random torrent name more specific
This commit is contained in:
TMD20 2022-11-14 12:18:08 -06:00 committed by GitHub
parent 51b0883786
commit 4b7e393ce9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,6 +91,7 @@ func (s *service) RunAction(action *domain.Action, release domain.Release) ([]st
Filter: release.Filter.Name,
Indexer: release.Indexer,
InfoHash: release.TorrentHash,
Size: release.Size,
Status: domain.ReleasePushStatusApproved,
Action: action.Name,
@ -177,7 +178,7 @@ func (s *service) watchFolder(action domain.Action, release domain.Release) erro
newFileName := watchFolderArgs
// if watchFolderArgs does not contain .torrent, create
if !strings.Contains(watchFolderArgs, ".torrent") {
if !strings.HasSuffix(watchFolderArgs, ".torrent") {
_, tmpFileName := filepath.Split(release.TorrentTmpFile)
newFileName = filepath.Join(watchFolderArgs, tmpFileName+".torrent")