Fix image location

This commit is contained in:
2025-08-29 21:17:59 +09:00
parent 999ce636ac
commit 631c7293fc

View File

@ -2581,9 +2581,13 @@ def get_team_info(request, zekken_number):
logger.info(f"Found goal record: id={goal_record.id}, goaltime={goal_record.goaltime}")
try:
goaltime = goal_record.goaltime
if goal_record.goalimage and hasattr(goal_record.goalimage, 'url'):
goalimage_url = request.build_absolute_uri(goal_record.goalimage.url)
logger.info(f"get_team_info record.goalimage_url={goalimage_url}")
if goal_record.goalimage:
# S3対応のget_image_url関数を使用
goalimage_url = get_image_url(goal_record.goalimage)
if goalimage_url:
logger.info(f"get_team_info record.goalimage_url={goalimage_url}")
else:
logger.warning(f"Failed to generate URL for goal image")
else:
logger.info(f"Goal record exists but no image found: goalimage={goal_record.goalimage}")
@ -2733,9 +2737,12 @@ def get_checkins(request, *args, **kwargs):
# 画像URLを生成
if checkin_image and checkin_image.checkinimage:
try:
if hasattr(checkin_image.checkinimage, 'url'):
image_url = request.build_absolute_uri(checkin_image.checkinimage.url)
# S3対応のget_image_url関数を使用
image_url = get_image_url(checkin_image.checkinimage)
if image_url:
logger.info(f"Found checkin image for CP {location.cp} (sub_loc_id: {location.sub_loc_id}): {image_url}")
else:
logger.warning(f"Failed to generate URL for checkin image CP {location.cp}")
except Exception as e:
logger.warning(f"Error accessing checkin image for CP {location.cp}: {str(e)}")
else: