From 34c7ada03d646079845fb7b5efe0f63ed1dfb2cc Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 8 Jun 2021 21:52:10 +0200 Subject: [PATCH 01/12] troubleshooting error --- tests/tests.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests.js b/tests/tests.js index 7609738d8..79bc50a8b 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -3835,6 +3835,7 @@ exports.defineAutoTests = function () { var img = new Image(); // eslint-disable-line no-undef img.onerror = function (err) { + console.log('Current error', err); expect(err).not.toBeDefined(); done(); }; From ceed8c5350928ea4f3253d9d315461f0a3a6b6a7 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Mon, 5 Jul 2021 12:46:13 +0200 Subject: [PATCH 02/12] troubleshooting error --- www/Entry.js | 11 +++++++++++ www/ios/FileSystem.js | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/www/Entry.js b/www/Entry.js index a67be96fa..478dcd0bf 100644 --- a/www/Entry.js +++ b/www/Entry.js @@ -52,6 +52,13 @@ function Entry (isFile, isDirectory, name, fullPath, fileSystem, nativeURL) { this.fullPath = fullPath || ''; this.filesystem = fileSystem || null; this.nativeURL = nativeURL || null; + + if (this.nativeURL) { + // todo move to fileSystem like the toInternalUrl + if(window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + this.nativeURL = window.WkWebView.convertFilePath(this.nativeURL); + } + } } /** @@ -191,6 +198,10 @@ Entry.prototype.toInternalURL = function () { */ Entry.prototype.toURL = function () { if (this.nativeURL) { + // todo move to fileSystem like the toInternalUrl as above + if(window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + return window.WkWebView.convertFilePath(this.nativeURL); + } return this.nativeURL; } // fullPath attribute may contain the full URL in the case that diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index cb14c783f..e9f88febf 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -22,8 +22,9 @@ FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { - __format__: function (fullPath) { - var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); - return FILESYSTEM_PROTOCOL + '://localhost' + path; + __format__: function (fullPath, internalUrl) { + return internalUrl; + // var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); + // return FILESYSTEM_PROTOCOL + '://localhost' + path; } }; From 61470c3cc24909ca26750e6809cde9f7ad3b3259 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Mon, 5 Jul 2021 16:54:35 +0200 Subject: [PATCH 03/12] troubleshooting error --- www/Entry.js | 4 ++-- www/ios/FileSystem.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/www/Entry.js b/www/Entry.js index 478dcd0bf..04ef5e145 100644 --- a/www/Entry.js +++ b/www/Entry.js @@ -55,7 +55,7 @@ function Entry (isFile, isDirectory, name, fullPath, fileSystem, nativeURL) { if (this.nativeURL) { // todo move to fileSystem like the toInternalUrl - if(window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + if (window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 this.nativeURL = window.WkWebView.convertFilePath(this.nativeURL); } } @@ -199,7 +199,7 @@ Entry.prototype.toInternalURL = function () { Entry.prototype.toURL = function () { if (this.nativeURL) { // todo move to fileSystem like the toInternalUrl as above - if(window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 return window.WkWebView.convertFilePath(this.nativeURL); } return this.nativeURL; diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index e9f88febf..875de10ab 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -23,8 +23,11 @@ FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { __format__: function (fullPath, internalUrl) { - return internalUrl; - // var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); - // return FILESYSTEM_PROTOCOL + '://localhost' + path; + // todo move to fileSystem like the toInternalUrl as above + if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + return window.WkWebView.convertFilePath(fullPath); + } + var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); + return FILESYSTEM_PROTOCOL + '://localhost' + path; } }; From 2eec0e84f689bf435f781789321dc010dc92c08e Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Mon, 5 Jul 2021 23:03:08 +0200 Subject: [PATCH 04/12] troubleshooting error --- www/Entry.js | 8 ++++---- www/ios/FileSystem.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/www/Entry.js b/www/Entry.js index 04ef5e145..d847da87f 100644 --- a/www/Entry.js +++ b/www/Entry.js @@ -55,9 +55,9 @@ function Entry (isFile, isDirectory, name, fullPath, fileSystem, nativeURL) { if (this.nativeURL) { // todo move to fileSystem like the toInternalUrl - if (window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + /*if (window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 this.nativeURL = window.WkWebView.convertFilePath(this.nativeURL); - } + }*/ } } @@ -199,9 +199,9 @@ Entry.prototype.toInternalURL = function () { Entry.prototype.toURL = function () { if (this.nativeURL) { // todo move to fileSystem like the toInternalUrl as above - if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + /*if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 return window.WkWebView.convertFilePath(this.nativeURL); - } + }*/ return this.nativeURL; } // fullPath attribute may contain the full URL in the case that diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index 875de10ab..fe06c08f4 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -24,9 +24,9 @@ FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { __format__: function (fullPath, internalUrl) { // todo move to fileSystem like the toInternalUrl as above - if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + /*if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 return window.WkWebView.convertFilePath(fullPath); - } + }*/ var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); return FILESYSTEM_PROTOCOL + '://localhost' + path; } From cb57c434f9d6f9447300d7a602d731daf538303f Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Mon, 5 Jul 2021 23:14:55 +0200 Subject: [PATCH 05/12] troubleshooting error --- www/ios/FileSystem.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index fe06c08f4..7fbdb7b43 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -24,9 +24,12 @@ FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { __format__: function (fullPath, internalUrl) { // todo move to fileSystem like the toInternalUrl as above - /*if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 - return window.WkWebView.convertFilePath(fullPath); - }*/ + console.log('__format__', fullPath, internalUrl); + if(internalUrl && window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + var convertedFilePath = window.WkWebView.convertFilePath(internalUrl); + console.log('convertedFilePath', convertedFilePath); + return convertedFilePath; + } var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); return FILESYSTEM_PROTOCOL + '://localhost' + path; } From 448ed803e3f475c454c818bd5c694d524d82d126 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 13:48:51 +0200 Subject: [PATCH 06/12] troubleshooting error --- www/Entry.js | 11 ----------- www/ios/FileSystem.js | 15 +++++++++------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/www/Entry.js b/www/Entry.js index d847da87f..a67be96fa 100644 --- a/www/Entry.js +++ b/www/Entry.js @@ -52,13 +52,6 @@ function Entry (isFile, isDirectory, name, fullPath, fileSystem, nativeURL) { this.fullPath = fullPath || ''; this.filesystem = fileSystem || null; this.nativeURL = nativeURL || null; - - if (this.nativeURL) { - // todo move to fileSystem like the toInternalUrl - /*if (window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 - this.nativeURL = window.WkWebView.convertFilePath(this.nativeURL); - }*/ - } } /** @@ -198,10 +191,6 @@ Entry.prototype.toInternalURL = function () { */ Entry.prototype.toURL = function () { if (this.nativeURL) { - // todo move to fileSystem like the toInternalUrl as above - /*if(window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 - return window.WkWebView.convertFilePath(this.nativeURL); - }*/ return this.nativeURL; } // fullPath attribute may contain the full URL in the case that diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index 7fbdb7b43..ab045e9ee 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -24,13 +24,16 @@ FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { __format__: function (fullPath, internalUrl) { // todo move to fileSystem like the toInternalUrl as above - console.log('__format__', fullPath, internalUrl); - if(internalUrl && window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 - var convertedFilePath = window.WkWebView.convertFilePath(internalUrl); - console.log('convertedFilePath', convertedFilePath); + console.error('__format__', fullPath, internalUrl); + var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); + var cdvFilePath = FILESYSTEM_PROTOCOL + '://localhost' + path; + + if (cdvFilePath && window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 + var convertedFilePath = window.WkWebView.convertFilePath(cdvFilePath); + console.error('convertedFilePath', cdvFilePath, convertedFilePath); return convertedFilePath; } - var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); - return FILESYSTEM_PROTOCOL + '://localhost' + path; + + return cdvFilePath; } }; From e87b6c405d0d7048e4706ecd85cb4358624db156 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 13:54:19 +0200 Subject: [PATCH 07/12] troubleshooting error --- www/ios/FileSystem.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index ab045e9ee..f1d491709 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -23,13 +23,12 @@ FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { __format__: function (fullPath, internalUrl) { - // todo move to fileSystem like the toInternalUrl as above console.error('__format__', fullPath, internalUrl); var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); var cdvFilePath = FILESYSTEM_PROTOCOL + '://localhost' + path; if (cdvFilePath && window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818 - var convertedFilePath = window.WkWebView.convertFilePath(cdvFilePath); + var convertedFilePath = window.WkWebView.convertFilePath(cdvFilePath); console.error('convertedFilePath', cdvFilePath, convertedFilePath); return convertedFilePath; } From 714494ba20223df35d6379db2d11509e817c4eb0 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 14:06:36 +0200 Subject: [PATCH 08/12] troubleshooting error --- www/File.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/File.js b/www/File.js index 30c620254..c9c143d00 100644 --- a/www/File.js +++ b/www/File.js @@ -40,6 +40,7 @@ var File = function (name, localURL, type, lastModifiedDate, size) { // These store the absolute start and end for slicing the file. this.start = 0; this.end = this.size; + }; /** From 2ed60ab65947b8703b755d613fce70b3f335105e Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 14:09:21 +0200 Subject: [PATCH 09/12] troubleshooting error --- tests/tests.js | 2 +- www/File.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/tests.js b/tests/tests.js index 79bc50a8b..3b98690dd 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -3835,7 +3835,7 @@ exports.defineAutoTests = function () { var img = new Image(); // eslint-disable-line no-undef img.onerror = function (err) { - console.log('Current error', err); + console.error('Current error', err); expect(err).not.toBeDefined(); done(); }; diff --git a/www/File.js b/www/File.js index c9c143d00..30c620254 100644 --- a/www/File.js +++ b/www/File.js @@ -40,7 +40,6 @@ var File = function (name, localURL, type, lastModifiedDate, size) { // These store the absolute start and end for slicing the file. this.start = 0; this.end = this.size; - }; /** From bb89f6ec59e365d0bd1f35e2c054ef0bbec8e7c8 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 14:13:51 +0200 Subject: [PATCH 10/12] troubleshooting error - revert this PIV --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d207d8c64..16f8fa563 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,4 +58,4 @@ jobs: - uses: codecov/codecov-action@v1 with: - fail_ci_if_error: true + fail_ci_if_error: false From 780b01e74ad0ecb64153b95d270c095348eec3d9 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 17:04:23 +0200 Subject: [PATCH 11/12] troubleshooting error - logging --- tests/tests.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tests.js b/tests/tests.js index 3b98690dd..5afa53b88 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -3832,7 +3832,8 @@ exports.defineAutoTests = function () { expect(entry.name).toCanonicallyMatch('logo.png'); expect(entry.fullPath).toCanonicallyMatch('/www/img/logo.png'); expect(entry.filesystem.name).toEqual(cdvfileApplicationDirectoryFsRootName); - + var internalURL = entry.toInternalURL(); + expect(internalURL).toEqual(internalURL, 'It should be an internalUrl what is it?' + internalURL); var img = new Image(); // eslint-disable-line no-undef img.onerror = function (err) { console.error('Current error', err); @@ -3842,7 +3843,7 @@ exports.defineAutoTests = function () { img.onload = function () { done(); }; - img.src = entry.toInternalURL(); + img.src = internalURL; }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for cdvfile applicationDirectory')); }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for cdvfile applicationDirectory')); }); From 8e5224109dd1258dbba99509cc1ab4c8279723e4 Mon Sep 17 00:00:00 2001 From: PVPoyer Date: Tue, 6 Jul 2021 20:48:46 +0200 Subject: [PATCH 12/12] troubleshooting error - logging --- tests/tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests.js b/tests/tests.js index 5afa53b88..1293ca37a 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -3833,7 +3833,7 @@ exports.defineAutoTests = function () { expect(entry.fullPath).toCanonicallyMatch('/www/img/logo.png'); expect(entry.filesystem.name).toEqual(cdvfileApplicationDirectoryFsRootName); var internalURL = entry.toInternalURL(); - expect(internalURL).toEqual(internalURL, 'It should be an internalUrl what is it?' + internalURL); + expect(internalURL).toEqual('wrong', 'It should be an internalUrl what is it?' + internalURL); var img = new Image(); // eslint-disable-line no-undef img.onerror = function (err) { console.error('Current error', err);