Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 15, 2025

Images were not displaying in GitHub issues created from BLT because URLs were malformed—relative URLs missing the protocol and absolute URLs being double-concatenated with the domain.

Root Cause

# Before: blindly concatenates domain with all URLs
screenshot_text += f"![{name}]({settings.FQDN}{screenshot.image.url})\n"
# Relative URL → blt.owasp.org/media/...           (missing https://)
# Absolute URL → blt.owasp.orghttps://storage...  (double concatenation)

Changes

  • Fixed URL formatting in create_github_issue(): check if URL is absolute before prepending domain
  • Improved error handling: removed exception details from user-facing error messages
  • Added tests: validate relative URL formatting, absolute URL preservation
# After: conditionally format based on URL type
image_url = screenshot.image.url
if not image_url.startswith(('http://', 'https://')):
    image_url = f"https://{settings.FQDN}{image_url}"
screenshot_text += f"![{name}]({image_url})\n"

This handles both Google Cloud Storage URLs (production) and local file paths (development) correctly.

Original prompt

This section details on the original issue you should resolve

<issue_title>image is not attaching to github issue</issue_title>
<issue_description>

0 https://blt.owasp.org/issue/2935 found by Anonymous at url: http://blt.owasp.org</issue_description>

Comments on the Issue (you are @copilot in this section)

@DonnieBLT This got fixed! @DonnieBLT Tested and it’s still a valid issue

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 15, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 15, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Fix image attachment not working in GitHub issue Fix image URL formatting in GitHub issue creation Nov 15, 2025
Copilot AI requested a review from DonnieBLT November 15, 2025 22:27
@DonnieBLT DonnieBLT marked this pull request as ready for review November 16, 2025 01:23
@github-actions github-actions bot added the files-changed: 2 PR changes 2 files label Nov 16, 2025
@DonnieBLT DonnieBLT added the d15 label Nov 16, 2025
@DonnieBLT DonnieBLT merged commit d9ea553 into main Nov 16, 2025
1 check passed
@DonnieBLT DonnieBLT deleted the copilot/fix-image-attachment-issue branch November 16, 2025 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 2 PR changes 2 files

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

image is not attaching to github issue

2 participants