Skip to content

Commit 2a33842

Browse files
committed
MarkdownComponent: minor tidying
1 parent 2625a82 commit 2a33842

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

modules/squarepine_graphics/components/squarepine_MarkdownComponent.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,13 +857,18 @@ std::unique_ptr<Drawable> MarkdownComponent::loadImage (const String& imageUrl,
857857
// Check if it's likely a web/non-local URL:
858858
if (imageUrl.startsWithIgnoreCase ("http"))
859859
{
860+
int statusCode = 200;
861+
const auto options = URL::InputStreamOptions (URL::ParameterHandling::inAddress)
862+
.withStatusCode (&statusCode)
863+
.withConnectionTimeoutMs (3000);
864+
860865
// Try loading as a web image:
861-
if (auto inputStream = url.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress)))
866+
if (auto inputStream = url.createInputStream (options))
862867
if (const auto image = ImageFileFormat::loadFrom (*inputStream); image.isValid())
863868
return std::make_unique<DrawableImage> (image);
864869

865870
// Try loading as a web SVG:
866-
if (auto inputStream = url.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress)))
871+
if (auto inputStream = url.createInputStream (options))
867872
{
868873
const auto svgData = inputStream->readEntireStreamAsString();
869874
if (svgData.isNotEmpty())

0 commit comments

Comments
 (0)