Skip to content

Commit

Permalink
Lessons: audio player shouldn't display file download dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
josecebe authored and Miguel Pellicer committed Sep 20, 2022
1 parent f06e78f commit 3090ea1
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

import org.sakaiproject.time.api.UserTimeService;
import org.sakaiproject.user.api.UserDirectoryService;
Expand Down Expand Up @@ -697,7 +698,17 @@ public void handleAccess(HttpServletRequest req, HttpServletResponse res, Refere
rfc1123Date.setTimeZone(TimeZone.getTimeZone("GMT"));
res.addHeader("Last-Modified", rfc1123Date.format(lastModTime));
}


// There is a problem embedding wav files and using the "audio/vnd.wave" mime type
// as the audio is rendered twice, on an <audio> tag and on an <object> tag for preventing
// the audio player tag could not work for that type of file, "audio/vnd.wave" mime type
// is being embedding before checking if it is a playable file for the audio player.
// changing the mime type to "audio/x-wav" will prevent the download of the file.
// "audio/vnd.wave", "audio/wav" and "audio/x-wav" should aslo get included into "content.mime.inline" property
if (StringUtils.equalsIgnoreCase(contentType, "audio/vnd.wave")) {
contentType = "audio/x-wav";
}

// for url resource type, encode a redirect to the body URL
// in 2.10 have to check resourcetype, but in previous releasese
// it doesn't get copied in site copy, so check content type. 10 doesn't set the contenttype to url
Expand Down

0 comments on commit 3090ea1

Please sign in to comment.