From 009af0e83377752ace1e6ff59e6f19b53d1f19d9 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Thu, 9 Nov 2017 15:52:35 -0800 Subject: [PATCH] Use `/files` prefix for PDF-like files --- notebook/static/tree/js/notebooklist.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/notebook/static/tree/js/notebooklist.js b/notebook/static/tree/js/notebooklist.js index 99458337a8..dcce051b66 100644 --- a/notebook/static/tree/js/notebooklist.js +++ b/notebook/static/tree/js/notebooklist.js @@ -563,6 +563,12 @@ define([ return model.mimetype === 'text/html' || includes_extension(model.path, viewable_extensions); }; + + // Files like PDF that should be opened using `/files` prefix + NotebookList.prototype._is_pdflike = function(model) { + var pdflike_extensions = ['pdf']; + return includes_extension(model.path, pdflike_extensions); + }; /** * Handles when any row selector checkbox is toggled. @@ -732,6 +738,10 @@ define([ { uri_prefix = 'view'; } + if (model.type === 'file' && this._is_pdflike(model)) + { + uri_prefix = 'files'; + } if (model.type === 'file' && this._is_notebook(model)) { uri_prefix = 'notebooks';