From 1864cb09bc8f049444a22dffa549778c4be61465 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 26 Aug 2014 15:42:33 -0700 Subject: [PATCH] Fixed #712. Fixed a bug with listing files/musics in admin files view due to removed trailing slashes. --- app/views/admin/FilesView.coffee | 1 + app/views/play/level/PlayLevelView.coffee | 1 + server_setup.coffee | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/admin/FilesView.coffee b/app/views/admin/FilesView.coffee index f444bd91a..784efabea 100644 --- a/app/views/admin/FilesView.coffee +++ b/app/views/admin/FilesView.coffee @@ -33,6 +33,7 @@ module.exports = class FilesView extends RootView currentFolder: -> @$el.find('#folder-select').val() loadFiles: -> + console.log 'trying to load', "/file/#{@currentFolder()}/" $.ajax url: "/file/#{@currentFolder()}/" success: @onLoadedFiles diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index dde56b11e..bfa752be3 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -466,6 +466,7 @@ module.exports = class PlayLevelView extends RootView pointer = $('#pointer') pointer.css('transition', 'all 0.6s ease-out') pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance-50}px)") + Backbone.Mediator.publish 'play-sound', trigger: 'dom_highlight', volume: 0.75 setTimeout((=> pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)").css('transition', 'all 0.4s ease-in')), 800) diff --git a/server_setup.coffee b/server_setup.coffee index bb72554c4..10a586713 100644 --- a/server_setup.coffee +++ b/server_setup.coffee @@ -77,7 +77,8 @@ setupRedirectMiddleware = (app) -> setupTrailingSlashRemovingMiddleware = (app) -> app.use (req, res, next) -> - return res.redirect 301, req.url[...-1] if req.url.length > 1 and req.url.slice(-1) is '/' + # Remove trailing slashes except for in /file/.../ URLs, because those are treated as directory listings. + return res.redirect 301, req.url[...-1] if req.url.length > 1 and req.url.slice(-1) is '/' and not /\/file\//.test req.url next() exports.setupMiddleware = (app) ->