Fixed #712. Fixed a bug with listing files/musics in admin files view due to removed trailing slashes.

This commit is contained in:
Nick Winter 2014-08-26 15:42:33 -07:00
parent a5c18a4140
commit 1864cb09bc
3 changed files with 4 additions and 1 deletions

View file

@ -33,6 +33,7 @@ module.exports = class FilesView extends RootView
currentFolder: -> @$el.find('#folder-select').val() currentFolder: -> @$el.find('#folder-select').val()
loadFiles: -> loadFiles: ->
console.log 'trying to load', "/file/#{@currentFolder()}/"
$.ajax $.ajax
url: "/file/#{@currentFolder()}/" url: "/file/#{@currentFolder()}/"
success: @onLoadedFiles success: @onLoadedFiles

View file

@ -466,6 +466,7 @@ module.exports = class PlayLevelView extends RootView
pointer = $('#pointer') pointer = $('#pointer')
pointer.css('transition', 'all 0.6s ease-out') pointer.css('transition', 'all 0.6s ease-out')
pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance-50}px)") pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance-50}px)")
Backbone.Mediator.publish 'play-sound', trigger: 'dom_highlight', volume: 0.75
setTimeout((=> setTimeout((=>
pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)").css('transition', 'all 0.4s ease-in')), 800) pointer.css('transform', "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)").css('transition', 'all 0.4s ease-in')), 800)

View file

@ -77,7 +77,8 @@ setupRedirectMiddleware = (app) ->
setupTrailingSlashRemovingMiddleware = (app) -> setupTrailingSlashRemovingMiddleware = (app) ->
app.use (req, res, next) -> 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() next()
exports.setupMiddleware = (app) -> exports.setupMiddleware = (app) ->