Fix worker resolution on using minified version

- When the minified version is used the resolver of the worker can not find it properly and throws 404 error.
- The problem was that:
  - It was getting the current name of the file.
  - It was replacing **.js** by **.worker.js**
- When it was loading the unminified version it was working fine because:
  - *pdf.js - .js + .worker.js*  = **pdf.worker.js**
- When it was loading the minified version it didtn't work because:
  - *pdf.min.js - .js + .worker.js* = **pdf.min.worker.js**
  - **pdf.min.worker.js** doesn't exist the real file name is **pdf.worker.min.js**
This commit is contained in:
TCASAS 2017-04-10 13:41:50 +02:00
parent d6dfc26d4e
commit 010d38a8c0

View File

@ -1097,7 +1097,7 @@ var PDFWorker = (function PDFWorkerClosure() {
if (typeof PDFJSDev !== 'undefined' &&
PDFJSDev.test('PRODUCTION && !(MOZCENTRAL || FIREFOX)') &&
pdfjsFilePath) {
return pdfjsFilePath.replace(/\.js$/i, '.worker.js');
return pdfjsFilePath.replace(/(\.(?:min\.)?js)$/i, '.worker$1');
}
error('No PDFJS.workerSrc specified');
}