fix: AdminAuth prefix matched too greedily
start_with?('/admin') also matched /admin-invoice-form.js, returning 401
for the public JS asset that the New Invoice form depends on. Without it,
the "+ add line" button did nothing.
Require either the bare /admin path or a /admin/-prefixed one so sibling
assets in public/ that happen to share the prefix stay reachable.
This commit is contained in:
parent
dc40faf5df
commit
c7fe108ecf
1 changed files with 2 additions and 1 deletions
|
|
@ -10,7 +10,8 @@ class AdminAuth
|
|||
end
|
||||
|
||||
def call(env)
|
||||
return @app.call(env) unless env['PATH_INFO'].to_s.start_with?('/admin')
|
||||
path = env['PATH_INFO'].to_s
|
||||
return @app.call(env) unless path == '/admin' || path.start_with?('/admin/')
|
||||
|
||||
auth = Rack::Auth::Basic::Request.new(env)
|
||||
if @user && @pass && auth.provided? && auth.basic? && auth.credentials == [@user, @pass]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue