From 9b67dca0e895ef03d5665b23931955492df59f00 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Thu, 21 Apr 2022 07:25:42 +0000 Subject: [PATCH] fix sublist routine --- bin/server.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/server.dart b/bin/server.dart index 3e966d3..481eecc 100644 --- a/bin/server.dart +++ b/bin/server.dart @@ -98,8 +98,8 @@ Future _postOnMastodon(reqJson) async { // If there are more than four photos, move other photos to another array to be posted in the thread. List otherPhotos = []; if (photoUrls.length > 4) { - otherPhotos = photos.skip(4).toList(); - photoUrls = photos.take(4).toList(); + otherPhotos = photoUrls.sublist(4); + photoUrls = photoUrls.sublist(0, 4); } // Post the post on Mastodon. @@ -143,8 +143,8 @@ Future _postOnMastodon(reqJson) async { while (otherPhotos.isNotEmpty) { mediaIds = []; if (otherPhotos.length > 4) { - otherPhotos = otherPhotos.skip(4).toList(); - photoUrls = otherPhotos.take(4).toList(); + otherPhotos = photoUrls.sublist(4); + photoUrls = photoUrls.sublist(0, 4); } else { photoUrls = otherPhotos; otherPhotos = [];