Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Elastic.Markdown/Myst/Directives/Image/ImageBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public class ImageBlock(DirectiveBlockParser parser, ParserContext context)

public string? Label { get; private set; }

private static readonly HashSet<string> AllowedUriHosts = ["epr.elastic.co"];

public override void FinalizeAndValidate(ParserContext context)
{
Label = Prop("label", "name");
Expand Down Expand Up @@ -98,7 +100,9 @@ private void ExtractImageUrl(ParserContext context)

if (Uri.TryCreate(imageUrl, UriKind.Absolute, out var uri) && uri.Scheme.StartsWith("http"))
{
this.EmitWarning($"{Directive} is using an external URI: {uri} ");
if (!AllowedUriHosts.Contains(uri.Host))
this.EmitWarning($"{Directive} is using an external URI: {uri} ");

Found = true;
ImageUrl = imageUrl;
return;
Expand Down
Loading