Fetch archived logs from S3 without redirect

This commit is contained in:
Piotr Sarnacki 2013-01-29 04:17:17 +01:00
parent 8202eaa452
commit f6baa172a5

View File

@ -22,12 +22,23 @@ require 'travis/model'
fetchBody: ->
self = this
Travis.ajax.ajax "/jobs/#{@get('job.id')}/log.txt", 'GET',
Travis.ajax.ajax "/jobs/#{@get('job.id')}/log.txt?cors_hax=true", 'GET',
dataType: 'text'
contentType: 'text/plain'
success: (data) ->
self.set 'body', data
self.set 'isLoaded', true
success: (data, textStatus, xhr) ->
if xhr.status == 204
logUrl = xhr.getResponseHeader('Location')
$.ajax
url: logUrl
type: 'GET'
success: (data) ->
self.fetchedBody(data)
else
self.fetchedBody(data)
fetchedBody: (body) ->
@set 'body', body
@set 'isLoaded', true
append: (body) ->
if @get('isInitialized')