Blog Post Comments - #comments anchor causing an error on 2nd page of comments RRS feed

  • Question

  • We have run into a problem with blog posts on our SharePoint 2013 on premise installation (15.0.4649.1000). The problem is with the blog on the users' MySites.  On the front page of the blog, (https://mysite.url/personal/user_name/Blog/default.aspx), you are presented with a listing of the blog posts - displayed as a summary view.  So, this includes:
    -  the title (linked to the post ie https://mysite.url/personal/user_name/Blog/Lists/Posts/Post.aspx?ID=5)
    -  the publication date
    -  an excerpt of the post
    -  the author, the time posted
    -  the number of comments (linked to the post - but with an anchor to the comment section ie https://mysite.url/personal/user_name/Blog/Lists/Posts/Post.aspx?ID=5#comments).

    If you click on the Title (ie https://mysite.url/personal/user_name/Blog/Lists/Posts/Post.aspx?ID=5) everything is fine - the problem does not come up.

    If you click on the number of comments (ie https://mysite.url/personal/user_name/Blog/Lists/Posts/Post.aspx?ID=5#comments), here's where things go wrong.  The initial page loads fine, but if there are more than 10 comments, you have to go to the next page.  If you click the arrow to go to the next page you get the following error:

    Exception from HRESULT: 0x80131904

    Correlation ID:20a9f49c-d329-0015-874e-4818b529d673

    If I check the ULS logs, this is what I see:

    System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the nvarchar value '5#comments' to data type int.    
     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)    
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)    
     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)    
     at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)    
     at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)    
     at System.Data.SqlClient.SqlDataReader.Read()    
     at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)    
     at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)  ClientConnectionId:e6cdabb3-a778-4c47-8024-73913a538b51  Error Number:245,State:1,Class:16

    So what I think is happening here, is that SharePoint is not stripping the comments anchor (#comments) from the post ID before it queries the database for all comments related to that post.  SQL is expecting an integer - in this case "5", but is instead getting "5#comments".

    For the time being we are going to let users know not to click on the comments, but to click on the title instead.  But we would like to correct this problem.

    Is there a fix for this?

    • Edited by Kw1rk Friday, March 20, 2015 8:32 PM
    Friday, March 20, 2015 8:20 PM