public void ClassifyLink() { ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.ClassifyLink"); string text = (string)base.GetParameter("uri"); Uri uri = Utilities.TryParseUri(text); if (uri == null && !text.StartsWith("\\\\", StringComparison.Ordinal)) { text = "http://" + text; uri = Utilities.TryParseUri(text); } if (uri == null || string.IsNullOrEmpty(uri.Scheme) || string.IsNullOrEmpty(uri.Host)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Cannot parse a Uri from string."); base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning); return; } if (!DocumentLibraryUtilities.IsTrustedProtocol(uri.Scheme)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI protocol is not http, https or file."); base.RenderPartialFailure(1453018462, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (!DocumentLibraryUtilities.IsInternalUri(uri.Host, base.UserContext)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Not an internal URI"); base.RenderPartialFailure(-1721073157, new Strings.IDs?(1325518514), ButtonDialogIcon.Warning); return; } if (DocumentLibraryUtilities.IsBlockedHostName(uri.Host, base.UserContext)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Host name is in the blocked list."); base.RenderPartialFailure(343095135, new Strings.IDs?(-777407791), ButtonDialogIcon.Warning); return; } ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(uri, base.UserContext); if (documentLibraryObjectId.Error != ClassificationError.None) { if (documentLibraryObjectId.Error == ClassificationError.ConnectionFailed) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Connection could not be made to server."); base.RenderPartialFailure(678272416, new Strings.IDs?(-820112926), ButtonDialogIcon.Warning); return; } if (documentLibraryObjectId.Error == ClassificationError.ObjectNotFound) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI object not found."); base.RenderPartialFailure(-54320700, new Strings.IDs?(1599334062), ButtonDialogIcon.Warning); return; } if (documentLibraryObjectId.Error == ClassificationError.AccessDenied) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI access is denied."); if (Utilities.IsBasicAuthentication(base.OwaContext.HttpContext.Request)) { base.RenderPartialFailure(234621291, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning); return; } base.RenderPartialFailure(1819837349, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning); return; } else { if (documentLibraryObjectId.Error == ClassificationError.UriTypeNotSupported) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI is not supported."); base.RenderPartialFailure(1453018462, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (documentLibraryObjectId.Error == ClassificationError.InvalidUri) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid."); base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning); return; } if (documentLibraryObjectId.Error == ClassificationError.ProxyError) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid."); base.RenderPartialFailure(1454208029, new Strings.IDs?(1335662059), ButtonDialogIcon.Warning); return; } ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Other classification error. ClassifyResult.Error: " + documentLibraryObjectId.Error.ToString()); base.RenderPartialFailure(-785304559, new Strings.IDs?(-86901060), ButtonDialogIcon.Warning); return; } } else { DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId; if (objectId == null) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from Uri"); base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning); return; } UriFlags uriFlags = objectId.UriFlags; bool flag = (uriFlags & UriFlags.Sharepoint) == UriFlags.Sharepoint; bool flag2 = (uriFlags & UriFlags.Unc) == UriFlags.Unc; bool flag3 = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext); bool flag4 = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext); if (objectId.UriFlags == UriFlags.Other) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Link could not be classified as Sharepoint or UNC"); if (flag4 && flag3) { base.RenderPartialFailure(1528018289, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (flag4) { base.RenderPartialFailure(-1758685302, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (flag3) { base.RenderPartialFailure(762710799, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); } return; } else { if ((flag2 && !flag4) || (flag && !flag3)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Segmentation failure. Access Denied"); base.RenderPartialFailure(flag2 ? 813043446 : -972777689, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning); return; } this.Writer.Write("<div id=uri>"); this.Writer.Write(text); this.Writer.Write("</div><div id=uf>"); this.Writer.Write((int)uriFlags); this.Writer.Write("</div><div id=oid>"); this.Writer.Write(objectId.ToBase64String()); this.Writer.Write("</div>"); AttachmentPolicy attachmentPolicy = base.UserContext.AttachmentPolicy; this.Writer.Write("<div id=divFwr>"); this.Writer.Write((attachmentPolicy.ForceWebReadyDocumentViewingFirst && DocumentLibraryUtilities.IsWebReadyDocument(objectId, base.UserContext)) ? 1 : 0); this.Writer.Write("</div>"); return; } } }