@attachment.Title
@attachment.TypeName / @(hasFile ? "Uploaded file" : "External link")
@model SceneEditViewModel @{ static string? FileHref(string? filePath) { if (string.IsNullOrWhiteSpace(filePath)) { return null; } return filePath.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? filePath : filePath.StartsWith("/") ? filePath : !System.IO.Path.IsPathRooted(filePath) ? "/" + filePath.TrimStart('/', '\\') : null; } static bool IsImageAttachment(string? href, string? filePath) { if (string.IsNullOrWhiteSpace(href) || string.IsNullOrWhiteSpace(filePath)) { return false; } var extension = System.IO.Path.GetExtension(filePath); return new[] { ".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp" } .Contains(extension, StringComparer.OrdinalIgnoreCase); } }
Storage used: @Model.StorageUsage.DisplayLabel
} @if (!Model.Attachments.Any()) {No scene references yet.
} else {@attachment.TypeName / @(hasFile ? "Uploaded file" : "External link")