Build log url manually if Location header can't be fetched
This commit is contained in:
parent
f6baa172a5
commit
28b17f97a0
|
@ -27,7 +27,12 @@ require 'travis/model'
|
||||||
contentType: 'text/plain'
|
contentType: 'text/plain'
|
||||||
success: (data, textStatus, xhr) ->
|
success: (data, textStatus, xhr) ->
|
||||||
if xhr.status == 204
|
if xhr.status == 204
|
||||||
logUrl = xhr.getResponseHeader('Location')
|
logUrl = xhr.getResponseHeader('X-Log-Location')
|
||||||
|
|
||||||
|
# For some reason not all browsers can fetch this header
|
||||||
|
unless logUrl
|
||||||
|
logUrl = self.s3Url("/jobs/#{self.get('job.id')}/log.txt")
|
||||||
|
|
||||||
$.ajax
|
$.ajax
|
||||||
url: logUrl
|
url: logUrl
|
||||||
type: 'GET'
|
type: 'GET'
|
||||||
|
@ -36,6 +41,13 @@ require 'travis/model'
|
||||||
else
|
else
|
||||||
self.fetchedBody(data)
|
self.fetchedBody(data)
|
||||||
|
|
||||||
|
s3Url: (path) ->
|
||||||
|
endpoint = Travis.config.api_endpoint
|
||||||
|
staging = if endpoint.match(/-staging/) then '-staging' else ''
|
||||||
|
host = Travis.config.api_endpoint.replace(/^https?:\/\//, '').split('.').slice(-2).join('.')
|
||||||
|
"https://s3.amazonaws.com/archive#{staging}.#{host}#{path}"
|
||||||
|
|
||||||
|
|
||||||
fetchedBody: (body) ->
|
fetchedBody: (body) ->
|
||||||
@set 'body', body
|
@set 'body', body
|
||||||
@set 'isLoaded', true
|
@set 'isLoaded', true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user