diff --git a/src/lib/viewers/doc/DocPreloader.js b/src/lib/viewers/doc/DocPreloader.js index a5c617796..fc2b958fc 100644 --- a/src/lib/viewers/doc/DocPreloader.js +++ b/src/lib/viewers/doc/DocPreloader.js @@ -13,8 +13,7 @@ import { PDFJS_WIDTH_PADDING_PX, PDFJS_HEIGHT_PADDING_PX } from '../../constants'; -import api from '../../api'; -import { setDimensions } from '../../util'; +import { setDimensions, fetchRepresentationAsBlob } from '../../util'; const EXIF_COMMENT_TAG_NAME = 'UserComment'; // Read EXIF data from 'UserComment' tag const EXIF_COMMENT_REGEX = /pdfWidth:([0-9.]+)pts,pdfHeight:([0-9.]+)pts,numPages:([0-9]+)/; @@ -81,7 +80,7 @@ class DocPreloader extends EventEmitter { this.containerEl = containerEl; // Need to load image as a blob to read EXIF - return api.get(preloadUrlWithAuth, { type: 'blob' }).then((imgBlob) => { + return fetchRepresentationAsBlob(preloadUrlWithAuth).then((imgBlob) => { if (this.checkDocumentLoaded()) { return; } diff --git a/src/lib/viewers/doc/__tests__/DocPreloader-test.js b/src/lib/viewers/doc/__tests__/DocPreloader-test.js index 1f8e83eeb..e2c87b821 100644 --- a/src/lib/viewers/doc/__tests__/DocPreloader-test.js +++ b/src/lib/viewers/doc/__tests__/DocPreloader-test.js @@ -50,7 +50,7 @@ describe('lib/viewers/doc/DocPreloader', () => { it('should set up preload DOM structure and bind image load handler', () => { const imgSrc = 'https://someblobimgsrc/'; - sandbox.stub(api, 'get').returns(Promise.resolve({})); + sandbox.stub(util, 'fetchRepresentationAsBlob').returns(Promise.resolve({})); sandbox.stub(URL, 'createObjectURL').returns(imgSrc); sandbox.stub(docPreloader, 'bindDOMListeners');