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 = [];