Add support for attachments on Folders
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java b/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
index 76ef0e1..5c57a39 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
@@ -1830,6 +1830,7 @@
         HtmlResponseWriter writer
             = createHtmlResponseWriter(response, metadataLength);
         writer.start(request.getDocId(), ObjectType.FOLDER, null);
+        processAttachments(listId, itemId, row, writer);
         processFolder(listId, folder.substring(root.length()), writer);
         writer.finish();
         log.exiting("SiteAdaptor", "getListItemDocContent");
@@ -1858,22 +1859,27 @@
         HtmlResponseWriter writer
             = createHtmlResponseWriter(response, metadataLength);
         writer.start(request.getDocId(), ObjectType.LIST_ITEM, title);
-        String strAttachments = row.getAttribute(OWS_ATTACHMENTS_ATTRIBUTE);
-        int attachments = (strAttachments == null || "".equals(strAttachments))
-            ? 0 : Integer.parseInt(strAttachments);
-        if (attachments > 0) {
-          writer.startSection(ObjectType.LIST_ITEM_ATTACHMENTS);
-          Item item
-              = siteDataClient.getContentListItemAttachments(listId, itemId);
-          for (Item.Attachment attachment : item.getAttachment()) {
-            writer.addLink(encodeDocId(attachment.getURL()), null);
-          }
-        }
+        processAttachments(listId, itemId, row, writer);
         writer.finish();
       }
       log.exiting("SiteAdaptor", "getListItemDocContent");
     }
 
+    private void processAttachments(String listId, String itemId, Element row,
+        HtmlResponseWriter writer) throws IOException {
+      String strAttachments = row.getAttribute(OWS_ATTACHMENTS_ATTRIBUTE);
+      int attachments = (strAttachments == null || "".equals(strAttachments))
+          ? 0 : Integer.parseInt(strAttachments);
+      if (attachments > 0) {
+        writer.startSection(ObjectType.LIST_ITEM_ATTACHMENTS);
+        Item item
+            = siteDataClient.getContentListItemAttachments(listId, itemId);
+        for (Item.Attachment attachment : item.getAttachment()) {
+          writer.addLink(encodeDocId(attachment.getURL()), null);
+        }
+      }
+    }
+
     private boolean getAttachmentDocContent(Request request, Response response)
         throws IOException {
       log.entering("SiteAdaptor", "getAttachmentDocContent", new Object[] {