+ Start a Discussion
kyle.tkyle.t 

FeedItem bug?

I think I may have identified a bug and need some help ensuring that I am right.  I have a trigger on the FeedItem object that checks to see if a filename contains jpg, png or gif.  from there it grabs the ContentData.  when loading a gif or png to a FeedItem, this works fine, but when I load a jpg, I am not seeing the data on the FeedItem

 

I have done some debuging and see that it returns Blob[0] for jpg but Blob[<large integer>] for gif and png.

 

the basic idea of the code is this: 

 

 

trigger myTrigger on FeedItem (after insert) {
    
    for(FeedItem f : trigger.new){
        if(f.ContentFileName <> null && 
            ( f.ContentFileName.toLowerCase().endsWith('jpg') ||
              f.ContentFileName.toLowerCase().endsWith('gif') ||
              f.ContentFileName.toLowerCase().endsWith('png') 
            )            
           )
     {
          System.debug(f.ContentData);

     }
}

 

Please let me know if there is something I am missing or if you are experiencing the same issue.

 

Ankit AroraAnkit Arora

This is strange but can you please check the file extension again that its jpg and NOT JPEG.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

kyle.tkyle.t

That is correct.  When I load, I am using a jpg.  In my actual code there is obviously logic that fires when it finds jpg in the filename and that is when my error is thrown.

kyle.tkyle.t

Also, I have tried multiple jpg files.  

 

Thank you.

Ritesh AswaneyRitesh Aswaney

I'm guessing you're doing the CloudSpokes challenge too !?


i've observer similar results too, png works fine, but jpg files are behaving erratically.

kyle.tkyle.t

You are correct.  I am noticing that it is acting erratically regardless of file type now. The file I was testing with over and over worked fine.  tried other .gif and .jpg files and it appears that the data is not stored properly in the ContentData. is that what you are observing?

kyle.tkyle.t

I think if figured something out... in the spirit of fair competition, I will say this... try requerying.  Good Luck.