4

I have a zip file containing images as a static resource. After repackaging the zip and uploading a new copy I'm no longer able to access the contents from VisualForce pages.

I access the image like this in the VF page:

<apex:image url="{!URLFOR($Resource.Doc_images, 'image.png')}"/>

That worked fine originally, but after updating the zip the image can no longer be found. The static resource is there and I can download it from <server>/resource/<id>/MyNamespace__Doc_images. The downloaded zip is not corrupted and appears to have the right files inside.

But <server>/resource/<id>/MyNamespace__Doc_images/image.png is not found.

Did anyone experience this before, and is there a solution / workaround?

3
  • Is there a namespace difference in the patch org which might cause it?
    – Matt Lacey
    May 18, 2013 at 3:44
  • 1
    Found the answer -- I forgot that I had repackaged the files after creating the patch, and in the process I created a zip with a root folder, whereas the original zip did not have one. I'm editing the question to properly describe the issue May 18, 2013 at 5:45
  • I was going to suggest that. I'm doing that all the time when I work with Static Resources. May 18, 2013 at 7:29

1 Answer 1

3

Turns out when I repackaged the zip I created it with a root directory, for a structure like this:

Root/image.png
...
Root/image-n.png

whereas the original had a flat list:

image.png
...
image-n.png

So of course the files were no longer found. Obvious in retrospect -- but I'll leave the question up in case it helps someone who makes the same mistake...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .