public IActionResult GetAttachmet([FromRoute] int topicId, [FromRoute] int attachmentId) { if (!_topicPermissions.IsAssociatedTo(User.Identity.GetUserIdentity(), topicId)) { return(Forbidden()); } try { var attachment = _attachmentsManager.GetAttachmentById(attachmentId); string fileName = Path.Combine(Constants.AttachmentFolder, topicId.ToString(), attachment.Path); var hash = DownloadManager.AddFile(fileName, HttpContext.Connection.RemoteIpAddress); return(Ok(new StringWrapper() { Value = hash })); } catch (InvalidOperationException) { return(NotFound()); } }