Fixed: A potential issue when extra files for multiple authors have the same relative path

(cherry picked from commit a6a68b4cae7688506c45ff6cf10989fe6596c274)

Closes #1650
This commit is contained in:
Mark McDowall
2022-04-12 17:46:10 -07:00
committed by Bogdan
parent 02fd733223
commit 44009e980b
3 changed files with 8 additions and 8 deletions
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Extras.Files
List<TExtraFile> GetFilesByAuthor(int authorId);
List<TExtraFile> GetFilesByBook(int authorId, int bookId);
List<TExtraFile> GetFilesByBookFile(int bookFileId);
TExtraFile FindByPath(string path);
TExtraFile FindByPath(int authorId, string path);
}
public class ExtraFileRepository<TExtraFile> : BasicRepository<TExtraFile>, IExtraFileRepository<TExtraFile>
@@ -55,9 +55,9 @@ namespace NzbDrone.Core.Extras.Files
return Query(c => c.BookFileId == bookFileId);
}
public TExtraFile FindByPath(string path)
public TExtraFile FindByPath(int authorId, string path)
{
return Query(c => c.RelativePath == path).SingleOrDefault();
return Query(c => c.AuthorId == authorId && c.RelativePath == path).SingleOrDefault();
}
}
}