Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • lj 81 posts 425 karma points
    Apr 18, 2014 @ 17:31
    lj
    0

    tag search bug

    Hi,

    I installed SmartBlog v2 and noticed when you click on one of the tags under the Tags Header it throws error if any of the existing posts dont have a tag attached to them. The error is comming from line 37 in the partial macro SmartListPosts.chtml. As a qucik fix i change the line from

    where ((IList)result.GetProperty("smartBlogTags").Value.ToString().Split(',')).Contains(Request.QueryString["tag"])

    to

    where (result.HasValue("smartBlogTags") && ((IList)result.GetProperty("smartBlogTags").Value.ToString().Split(',')).Contains(Request.QueryString["tag"]))

    Thanks

    lj

     

  • Luke Alderton 192 posts 509 karma points
    Apr 22, 2014 @ 11:37
    Luke Alderton
    0

    Hi lj,

    Thanks for letting me know, this fix will be in the next version release. :D

    Luke

  • Bruno Olsen 75 posts 316 karma points
    Jul 18, 2014 @ 09:46
    Bruno Olsen
    0

    Actually I get an error with this fix...

    I installed SmartBlog v 2.0.7 on Umbraco 7.1.4.

    Category search work fine, but author and tag search fails:

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error: 

    Line 31:     {
    Line 32:         results = (from result in results
    Line 33: where (result.HasValue("smartBlogTags") && ((IList<string>)result.GetProperty("tag").Value.ToString().Split(',')).Contains(Request.QueryString["tag"])) Line 34:                    select result).ToList();
    Line 35:     }

    and:

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error: 

    Line 39:     {
    Line 40:         results = (from result in results
    Line 41: where ((IList<string>)result.GetProperty("smartBlogAuthor").Value.ToString().Split(',')).Contains(Request.QueryString["author"]) || Line 42:                            (Request.QueryString["author"] == document.GetElementsByTagName("defaultAuthor")[0].InnerText && result.GetProperty("author").Value.ToString().Length == 0)
    Line 43:      

     

    Now, author is set on all posts, and all posts have at least on tag. It shouldn't be due to the fact that the blog is not in the root, or is that a wrong assumption?

    Kind regards,
    Bruno

  • Jonathan Sedman 4 posts 24 karma points
    Jul 18, 2014 @ 16:57
    Jonathan Sedman
    0

    I think the issue for both of these is that the GetProperty is referencing the wrong property.

    line 33 says

            results = (from result in results
                   where (result.HasValue("smartBlogTags") && ((IList<string>)result.GetProperty("tag").Value.ToString().Split(',')).Contains(Request.QueryString["tag"]))
                   select result).ToList();
    

    where is should say

            results = (from result in results
                   where (result.HasValue("smartBlogTags") && ((IList<string>)result.GetProperty("smartBlogTags").Value.ToString().Split(',')).Contains(Request.QueryString["tag"]))
                   select result).ToList();
    

    The difference being

    result.GetProperty("tag")
    

    is changed to

    result.GetProperty("smartBlogTags")
    

    This fixed mine anyway.

  • Luke Alderton 192 posts 509 karma points
    Jul 22, 2014 @ 11:20
    Luke Alderton
    0

    Hi Bruno & Jonathan,

    Thank you for taking the time to investigate this issue, I have just updated the projects source code. I'll compile and upload a new version today.

    Thanks again, Luke

Please Sign in or register to post replies

Write your reply to:

Draft