Skip to content

Commit

Permalink
feat: Location header relative path compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kukhariev committed Jun 20, 2018
1 parent 5fa12e0 commit 64f377c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/uploadx/src/uploader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Subject } from 'rxjs';

import * as url from 'url';
import { BackoffRetry } from './backoffRetry';
import { XHRFactory } from './xhrfactory';
import {
Expand Down Expand Up @@ -121,11 +121,13 @@ export class Uploader implements UploaderOptions {
if (xhr.status < 400 && xhr.status > 199) {
// get secure upload link
this.response = xhr.response;
this.URI = xhr.getResponseHeader('Location');
if (!this.URI) {
const location = xhr.getResponseHeader('Location');
if (!location) {
this.status = 'error';
reject(this);
} else {
console.log(this.options.url, location);
this.URI = url.resolve(this.options.url, location);
this.status = 'queue';
resolve(this);
}
Expand Down

0 comments on commit 64f377c

Please sign in to comment.