Resonate icon indicating copy to clipboard operation
Resonate copied to clipboard

Issue while adding stories due to incorrect implementation of createStory function

Open M4dhav opened this issue 8 months ago • 1 comments

🐛 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.

M4dhav avatar Mar 26 '25 11:03 M4dhav

@Aarush-Acharya please assign this to me

M4dhav avatar Mar 26 '25 11:03 M4dhav