fix: Improve sanitizing for trickplay (#158)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2024-11-19 19:47:06 +01:00 committed by GitHub
parent ddb71ef835
commit df7002d990
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -906,10 +906,16 @@ class JellyService {
if (server == null) return null;
final lines = response.bodyString.split('\n')..removeWhere((element) => element.startsWith('#'));
final sanitizedUrls = response.bodyString
.split('\n')
.where((line) => line.isNotEmpty && !line.startsWith('#'))
.map((line) => line.trim())
.map((line) => Uri.parse(line).toString())
.toList();
return response.copyWith(
body: trickPlayModel.copyWith(
images: lines
images: sanitizedUrls
.map(
(e) => joinAll([server, 'Videos/${item.id}/Trickplay/${trickPlayModel.width}', e]),
)

View file

@ -457,7 +457,7 @@ class SyncNotifier extends StateNotifier<SyncSettingsModel> {
try {
if (!skipDownload && currentTask.task == null) {
final downloadTask = DownloadTask(
url: downloadString,
url: Uri.parse(downloadString).toString(),
directory: syncItem.directory.path,
filename: syncItem.videoFileName,
updates: Updates.statusAndProgress,