private string GetInlineReferenceUrl(AttachmentPolicy.Level level, AttachmentLink imageAttachmentLink, HtmlWriter writer) { imageAttachmentLink.MarkInline(true); if (AttachmentPolicy.Level.Allow == level) { StringBuilder stringBuilder = new StringBuilder(); if (this.isEmbeddedItem) { stringBuilder.Append(this.embeddedItemUrl); } else { stringBuilder.Append(OwaSafeHtmlCallbackBase.AttachmentBaseUrl); bool flag = this.owaStoreObjectIdType == OwaStoreObjectIdType.OtherUserMailboxObject || this.owaStoreObjectIdType == OwaStoreObjectIdType.ArchiveMailboxObject; OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromItemId(this.itemId, flag ? null : this.parentId, this.owaStoreObjectIdType, this.legacyDN); stringBuilder.Append(Utilities.UrlEncode(owaStoreObjectId.ToString())); stringBuilder.Append("&attcnt=1&attid0="); } stringBuilder.Append(Utilities.UrlEncode(imageAttachmentLink.AttachmentId.ToBase64String())); if (!this.isEmbeddedItem && !string.IsNullOrEmpty(imageAttachmentLink.ContentId)) { stringBuilder.Append("&attcid0="); stringBuilder.Append(Utilities.UrlEncode(imageAttachmentLink.ContentId)); } return(stringBuilder.ToString()); } this.hasBlockedImagesInCurrentPass = true; this.hasBlockedInlineAttachments = true; return(OwaSafeHtmlOutboundCallbacks.BlockedUrlPageValue); }
private string GetOrGenerateAttachContentId(AttachmentLink attachmentLink) { StoreObjectId key = this.itemId; if (this.existingContentIds == null && !Command.CurrentCommand.InlineAttachmentContentIdLookUp.TryGetValue(key, out this.existingContentIds)) { this.existingContentIds = new Dictionary <AttachmentId, string>(1); Command.CurrentCommand.InlineAttachmentContentIdLookUp[key] = this.existingContentIds; } string text; if (this.existingContentIds.TryGetValue(attachmentLink.AttachmentId, out text) && !string.IsNullOrEmpty(text)) { attachmentLink.ContentId = text; } else { if (string.IsNullOrEmpty(attachmentLink.ContentId)) { attachmentLink.ContentId = Guid.NewGuid().ToString(); } this.existingContentIds[attachmentLink.AttachmentId] = attachmentLink.ContentId; } attachmentLink.MarkInline(true); return(attachmentLink.ContentId); }
private void MarkInlineAttachment(string srcValue) { string contentId = HtmlUpdateBodyCallback.GetContentId(srcValue); if (contentId == null) { ExTraceGlobals.CommonAlgorithmTracer.TraceDebug <string>((long)this.GetHashCode(), "HtmlUpdateBodyCallback.MarkInlineAttachment. Content ID is empty for {0}", srcValue); return; } AttachmentId attachmentId = this.FindAttachmentId(contentId); if (attachmentId == null) { ExTraceGlobals.CommonAlgorithmTracer.TraceDebug <string>((long)this.GetHashCode(), "HtmlUpdateBodyCallback.MarkInlineAttachment. Attachment ID not found for {0}", srcValue); return; } AttachmentLink attachmentLink = base.FindAttachmentByIdOrContentId(attachmentId, contentId); if (attachmentLink == null) { ExTraceGlobals.CommonAlgorithmTracer.TraceDebug <string>((long)this.GetHashCode(), "HtmlUpdateBodyCallback.MarkInlineAttachment. No attachment link found for {0}", srcValue); return; } attachmentLink.MarkInline(true); }