Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/app/process-page/detail/process-detail.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ describe('ProcessDetailComponent', () => {
const outputProcess = fixture.debugElement.query(By.css('#process-output pre'));
expect(outputProcess.nativeElement.textContent).toContain(processOutput);
});
it('should request the output logs without a token in the URL', () => {
expect((httpClient.get as jasmine.Spy).calls.mostRecent().args[0]).toBe('log-selflink');
});
});

describe('if press show output logs and process has no output logs', () => {
Expand Down
12 changes: 3 additions & 9 deletions src/app/process-page/detail/process-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
getFirstSucceededRemoteData,
getFirstSucceededRemoteDataPayload
} from '../../core/shared/operators';
import { URLCombiner } from '../../core/url-combiner/url-combiner';
import { AlertType } from '../../shared/alert/alert-type';
import { hasValue } from '../../shared/empty.util';
import { ProcessStatus } from '../processes/process-status.model';
Expand Down Expand Up @@ -55,7 +54,7 @@ export class ProcessDetailComponent implements OnInit, OnDestroy {
filesRD$: Observable<RemoteData<PaginatedList<Bitstream>>>;

/**
* File link that contain the output logs with auth token
* Link to the file that contains the output logs
*/
outputLogFileUrl$: Observable<string>;

Expand Down Expand Up @@ -203,13 +202,8 @@ export class ProcessDetailComponent implements OnInit, OnDestroy {
this.showOutputLogs = true;
}
}),
switchMap((processOutput: RemoteData<Bitstream>) => {
const url = processOutput.payload._links.content.href;
return this.authService.getShortlivedToken().pipe(take(1),
map((token: string) => {
return hasValue(token) ? new URLCombiner(url, `?authentication-token=${token}`).toString() : url;
}));
})
// HttpClient sends the Authorization header, so the URL needs no token.
map((processOutput: RemoteData<Bitstream>) => processOutput.payload._links.content.href)
);
});
this.outputLogFileUrl$.pipe(take(1),
Expand Down
Loading