Fix fetching log in firefox when Location header is unavailable

This commit is contained in:
Piotr Sarnacki 2013-04-02 20:17:24 +02:00
parent 46413b66fb
commit 7996358f01
2 changed files with 7 additions and 1 deletions

View File

@ -64,7 +64,7 @@ Travis.Log.Request = Em.Object.extend
endpoint = Travis.config.api_endpoint
staging = if endpoint.match(/-staging/) then '-staging' else ''
host = endpoint.replace(/^https?:\/\//, '').split('.').slice(-2).join('.')
"https://s3.amazonaws.com/archive#{staging}.#{host}#{path}/jobs/#{@id}/log.txt"
"https://s3.amazonaws.com/archive#{staging}.#{host}/jobs/#{@get('id')}/log.txt"
isJson: (xhr, body) ->
# Firefox can't see the Content-Type header on the xhr response due to the wrong

View File

@ -0,0 +1,6 @@
describe 'Travis.Log.Request', ->
it 'constructs s3 url for log', ->
Travis.config.api_endpoint = 'api.travis-ci.org'
request = Travis.Log.Request.create(id: 10)
s3Url = "https://s3.amazonaws.com/archive.travis-ci.org/jobs/10/log.txt"
expect( request.s3Url() ).toEqual(s3Url)