fix(api-redirect): update regex used for determining when to redirect
With the old redirect, repositories with "png" in the name got redirected as well as images.
This commit is contained in:
parent
ed959be433
commit
24a3714d62
|
@ -18,7 +18,7 @@ class Travis::Web::ApiRedirect < Sinatra::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get NotPublicImages.new(%r{^/([^/]+)/([^/]+).png}, %r{^/images/}) do
|
get NotPublicImages.new(%r{^/([^/]+)/([^/]+)\.png$}, %r{^/images/}) do
|
||||||
redirect!
|
redirect!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,8 @@ describe Travis::Web::ApiRedirect do
|
||||||
it 'redirects /:owner/:repo.png' do
|
it 'redirects /:owner/:repo.png' do
|
||||||
get('/foo/bar.png').should be_redirect
|
get('/foo/bar.png').should be_redirect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not redirect /owner/some-png-repo' do
|
||||||
|
get('/owner/some-png-repo').should_not be_redirect
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user