Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to MIME type when downloading doc in jQuery mode #989

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2116,12 +2116,13 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'settingsStore','abstractFilesys
function goToArticle(path, download, contentType) {
document.getElementById('searchingArticles').style.display = '';
selectedArchive.getDirEntryByPath(path).then(function(dirEntry) {
var mimetype = contentType || dirEntry ? dirEntry.getMimetype() : '';
if (dirEntry === null || dirEntry === undefined) {
document.getElementById('searchingArticles').style.display = 'none';
uiUtil.systemAlert("Article with url " + path + " not found in the archive", "Error: article not found");
} else if (download) {
} else if (download || /\/(epub|pdf|zip|.*opendocument|.*officedocument|tiff|mp4|webm|mpeg|mp3|octet-stream)\b/i.test(mimetype)) {
download = true;
selectedArchive.readBinaryFile(dirEntry, function (fileDirEntry, content) {
var mimetype = contentType || fileDirEntry.getMimetype();
uiUtil.displayFileDownloadAlert(path, download, mimetype, content);
});
} else {
Expand Down