diff --git a/portal-impl/src/com/liferay/portlet/wiki/action/GetPageAttachmentAction.java b/portal-impl/src/com/liferay/portlet/wiki/action/GetPageAttachmentAction.java
index cba764cf926a3427cf2cd8f8b8ee6ed39cbc7eea..8a1ce0a5ad601018b985176897bf11517f9e0e6e 100644
--- a/portal-impl/src/com/liferay/portlet/wiki/action/GetPageAttachmentAction.java
+++ b/portal-impl/src/com/liferay/portlet/wiki/action/GetPageAttachmentAction.java
@@ -14,11 +14,14 @@
 
 package com.liferay.portlet.wiki.action;
 
+import com.liferay.portal.kernel.flash.FlashMagicBytesUtil;
 import com.liferay.portal.kernel.log.Log;
 import com.liferay.portal.kernel.log.LogFactoryUtil;
 import com.liferay.portal.kernel.repository.model.FileEntry;
 import com.liferay.portal.kernel.servlet.ServletResponseUtil;
+import com.liferay.portal.kernel.util.FileUtil;
 import com.liferay.portal.kernel.util.ParamUtil;
+import com.liferay.portal.kernel.util.StringPool;
 import com.liferay.portal.kernel.workflow.WorkflowConstants;
 import com.liferay.portal.portletfilerepository.PortletFileRepositoryUtil;
 import com.liferay.portal.struts.ActionConstants;
@@ -28,9 +31,12 @@ import com.liferay.portlet.documentlibrary.NoSuchFileException;
 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
 import com.liferay.portlet.trash.util.TrashUtil;
 import com.liferay.portlet.wiki.NoSuchPageException;
+import com.liferay.portlet.wiki.importers.mediawiki.MediaWikiImporter;
 import com.liferay.portlet.wiki.model.WikiPage;
 import com.liferay.portlet.wiki.service.WikiPageServiceUtil;
 
+import java.io.InputStream;
+
 import javax.portlet.PortletConfig;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
@@ -85,6 +91,18 @@ public class GetPageAttachmentAction extends PortletAction {
 			long nodeId = ParamUtil.getLong(request, "nodeId");
 			String title = ParamUtil.getString(request, "title");
 			String fileName = ParamUtil.getString(request, "fileName");
+
+			if (fileName.startsWith(
+					MediaWikiImporter.SHARED_IMAGES_TITLE + StringPool.SLASH)) {
+
+				String[] fileNameParts = fileName.split(
+					MediaWikiImporter.SHARED_IMAGES_TITLE + StringPool.SLASH);
+
+				fileName = fileNameParts[1];
+
+				title = MediaWikiImporter.SHARED_IMAGES_TITLE;
+			}
+
 			int status = ParamUtil.getInteger(
 				request, "status", WorkflowConstants.STATUS_APPROVED);
 
@@ -130,9 +148,20 @@ public class GetPageAttachmentAction extends PortletAction {
 			fileName = TrashUtil.getOriginalTitle(dlFileEntry.getTitle());
 		}
 
+		InputStream is = fileEntry.getContentStream();
+
+		FlashMagicBytesUtil.Result flashMagicBytesUtilResult =
+			FlashMagicBytesUtil.check(is);
+
+		if (flashMagicBytesUtilResult.isFlash()) {
+			fileName = FileUtil.stripExtension(fileName) + ".swf";
+		}
+
+		is = flashMagicBytesUtilResult.getInputStream();
+
 		ServletResponseUtil.sendFile(
-			request, response, fileName, fileEntry.getContentStream(),
-			fileEntry.getSize(), fileEntry.getMimeType());
+			request, response, fileName, is, fileEntry.getSize(),
+			fileEntry.getMimeType());
 	}
 
 	@Override
