Resonate
Resonate copied to clipboard
Issue while adding stories due to incorrect implementation of createStory function
🐛 Describe the bug
In the create story function when the pushChaptersToStory function is called, the cover images for each chapter is uploaded with the same storyId being passed to the function.
Future<void> pushChaptersToStory(
List<Chapter> chapters, String storyId) async {
for (Chapter chapter in chapters) {
String colorString = chapter.tintColor.toString();
String extractedColor = colorString.substring(8, 14);
String coverImgUrl = chapter.coverImageUrl;
if (!coverImgUrl.contains("http")) {
coverImgUrl = await uploadFileToAppwriteGetUrl(
storyBucketId, storyId, coverImgUrl, "story cover");
}...
This instead needs to be uploaded with the chapterId instead of the storyId as this later causes a conflict when the app tries to upload the chapter images already having uploaded a story image which has the same ID and thus produces the following error:
[log] failed to upload story cover to appwrite: A storage file with the requested ID already exists.
@Aarush-Acharya please assign this to me