From aab7a8713e5ad7d665915abc82bb72b5417cdd0c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 20 Aug 2015 15:56:30 +0100 Subject: [PATCH] Catch the case where filename is shorter than the extension length. --- .../coffee/Features/FileStore/FileStoreController.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/FileStore/FileStoreController.coffee b/services/web/app/coffee/Features/FileStore/FileStoreController.coffee index 17e3fb40f4..c36ce22151 100644 --- a/services/web/app/coffee/Features/FileStore/FileStoreController.coffee +++ b/services/web/app/coffee/Features/FileStore/FileStoreController.coffee @@ -8,7 +8,12 @@ is_mobile_safari = (user_agent) -> user_agent.indexOf('iPad') >= 0) is_html = (file) -> - file.name.lastIndexOf('.html') == file.name.length - 5 + ends_with = (ext) -> + file.name? and + file.name.length > ext.length and + (file.name.lastIndexOf(ext) == file.name.length - ext.length) + + ends_with('.html') or ends_with('.htm') or ends_with('.xhtml') module.exports =