From 85cb9bc5a37784f266217925929bc654de1f2c99 Mon Sep 17 00:00:00 2001
From: gnaegi <none@none>
Date: Fri, 13 Dec 2013 16:12:33 +0100
Subject: [PATCH] OO-883 set ms office documents to downloadable also in folder
 component

---
 .../core/commons/modules/bc/commands/CmdServeResource.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/olat/core/commons/modules/bc/commands/CmdServeResource.java b/src/main/java/org/olat/core/commons/modules/bc/commands/CmdServeResource.java
index 56bc307f2d5..ef4cedad879 100644
--- a/src/main/java/org/olat/core/commons/modules/bc/commands/CmdServeResource.java
+++ b/src/main/java/org/olat/core/commons/modules/bc/commands/CmdServeResource.java
@@ -136,7 +136,12 @@ public class CmdServeResource implements FolderCommand {
 				mr = vmr;
 			} else {
 				// binary data: not .html, not .htm, not .js -> treated as is
-				mr = new VFSMediaResource(vfsfile);
+				VFSMediaResource vmr = new VFSMediaResource(vfsfile);
+				// This is to prevent the login prompt in Excel, Word and PowerPoint
+				if (path.endsWith(".xlsx") || path.endsWith(".pptx") || path.endsWith(".docx")) {
+					vmr.setDownloadable(true);
+				}
+				mr = vmr;
 			}
 		}
 		
-- 
GitLab