From 8773929c0e6fc2cd9a2342ffe180a7033f1fecc4 Mon Sep 17 00:00:00 2001 From: caspar Date: Fri, 15 Nov 2024 21:27:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Fix=20line=20sticker=20URL=20to=20preven?= =?UTF-8?q?t=20certain=20images=20from=20failing=20to=20d=E2=80=A6=20(#104?= =?UTF-8?q?16)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the issue with Line stickers URLs to prevent certain images from failing to display. The problem was due to the use of incorrect URLs. The original URLs pointed to the `iphone` variant, which failed to load properly in some cases. The fix updates the URLs to use the `android` variant, ensuring all images are displayed correctly. ### Example: - Original (failing URL): `https://stickershop.line-scdn.net/stickershop/v1/sticker/17/iphone/sticker.png` - Fixed (working URL): `https://stickershop.line-scdn.net/stickershop/v1/sticker/17/android/sticker.png` ## How Has This Been Tested? 1. Verified the updated URLs by loading multiple Line sticker images to ensure they display correctly. 2. Tested in both local and production-like environments to confirm the fix resolves the issue. 3. Reviewed logs to ensure no additional errors are generated related to Line sticker URLs. --- app/services/line/incoming_message_service.rb | 2 +- spec/services/line/incoming_message_service_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/line/incoming_message_service.rb b/app/services/line/incoming_message_service.rb index f36bce0f0..4761292d0 100644 --- a/app/services/line/incoming_message_service.rb +++ b/app/services/line/incoming_message_service.rb @@ -4,7 +4,7 @@ class Line::IncomingMessageService include ::FileTypeHelper pattr_initialize [:inbox!, :params!] - LINE_STICKER_IMAGE_URL = 'https://stickershop.line-scdn.net/stickershop/v1/sticker/%s/iphone/sticker.png'.freeze + LINE_STICKER_IMAGE_URL = 'https://stickershop.line-scdn.net/stickershop/v1/sticker/%s/android/sticker.png'.freeze def perform # probably test events diff --git a/spec/services/line/incoming_message_service_spec.rb b/spec/services/line/incoming_message_service_spec.rb index 037aa18fa..3bcdf8b04 100644 --- a/spec/services/line/incoming_message_service_spec.rb +++ b/spec/services/line/incoming_message_service_spec.rb @@ -178,7 +178,7 @@ describe Line::IncomingMessageService do described_class.new(inbox: line_channel.inbox, params: sticker_params).perform expect(line_channel.inbox.conversations).not_to eq(0) expect(Contact.all.first.name).to eq('LINE Test') - expect(line_channel.inbox.messages.first.content).to eq('![sticker-52002738](https://stickershop.line-scdn.net/stickershop/v1/sticker/52002738/iphone/sticker.png)') + expect(line_channel.inbox.messages.first.content).to eq('![sticker-52002738](https://stickershop.line-scdn.net/stickershop/v1/sticker/52002738/android/sticker.png)') end end