You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2022/07/18 01:53:58 UTC

[GitHub] [cordova-plugin-file-transfer] michaelpeterlee opened a new issue, #345: Cordova 11 > Android incompatible

michaelpeterlee opened a new issue, #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345

   Does not work with Cordova 11 Android; `cordova build android` fails.
   
   Errors due to `cordova-plugin-whitelist` missing. 
   
   Include `cordova-plugin-whitelist` and `cordova build android` fails due to an incompatibility with `cordova-plugin-whitelist`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1188503996

   Additional to this, we can no-longer `download()` due to error, below.
   
   We downgraded dependency `cordova-plugin-file@6.0.2` to no-avail also.
   
   ```
   const oFileEntry = _oFileSystem.root.getFile('myfile.png',{create:true,exclusive:false} ...
   const sFullPath = oFileEntry.toUrl();
   const sURL = 'https://mydomain.com/myfile.png';
   
   oFileTransfer = new FileTransfer();
   
   oFileTransfer.download(
     sURL,
     sFullPath,
     function success(oFile) {
       alert("That's all folks!");
     },
     fFail,
     false,
     null
   );
   
   // fFail() presents the following error object:
   
   FileTransferError =
   {
     body: null,
     code: 3,
     exception: null,
     http_status: 401,
     source: "https://mydomain.com/myfile.png",
     target: "file:///data/user/0/com.mydomain.myapp/files/myfile.png"
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee closed issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee closed issue #345: Cordova 11 > Android incompatible
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] sandeepbhatkande commented on issue #345: Cordova 11 > Android incompatible

Posted by "sandeepbhatkande (via GitHub)" <gi...@apache.org>.
sandeepbhatkande commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1463196676

   > 
   
   Have you got solution? I am also stuck in same issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1186687940

   Contrary to the README.MD, to install you must reference the repo not the Cordova plugin registry:
   
   `cordova plugin add https://github.com/apache/cordova-plugin-file-transfer.git`.
   
   Can you please update the readme.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1378072296

   > finally found a plugin for file transfer and it's working!!! https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer
   > 
   > tried and tested
   
   I still receive HTTP 401 error with that fork.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] pixellet14 commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
pixellet14 commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1291765485

   > Here is a hook I did:
   > 
   > config.xml: `<hook type="after_prepare" src="hooks/hook-android-fix-file-transfer.js" info="Comment out whitelist code" />`
   > 
   > hook-android-fix-file-transfer.js:
   > 
   > ```
   > const fs = require('fs-extra');
   > const path = require('path');
   > 
   > const DIR = path.join(__dirname, '../');
   > 
   > /**
   >  * This hook removes whitelist from FileTransfer.java
   >  * see : https://github.com/apache/cordova-plugin-file-transfer/issues/345
   >  */
   > module.exports = function main(ctx) {
   >     if (!ctx.opts.platforms.includes('android')) return;
   > 
   >     console.log('[hook] Fix file transfer on android');
   > 
   >     const file = `${DIR}/platforms/android/app/src/main/java/org/apache/cordova/filetransfer/FileTransfer.java`;
   >     let code = `import org.apache.cordova.Whitelist;`
   >     let commentedOut = `//  Commented out by hook-android-fix-file-transfer.js
   > //  import org.apache.cordova.Whitelist;`
   > 
   >     let str = fs.readFileSync(file, 'utf8');
   >     str = str.replace(code, commentedOut);
   > 
   >     code = `        if (shouldAllowRequest == null) {
   >             try {
   >                 Method gwl = webView.getClass().getMethod("getWhitelist");
   >                 Whitelist whitelist = (Whitelist)gwl.invoke(webView);
   >                 shouldAllowRequest = whitelist.isUrlWhiteListed(source);
   >             } catch (NoSuchMethodException e) {
   >             } catch (IllegalAccessException e) {
   >             } catch (InvocationTargetException e) {
   >             }
   >         }`
   >     commentedOut = `//  Commented out by hook-android-fix-file-transfer.js
   > //          if (shouldAllowRequest == null) {
   > //            try {
   > //                Method gwl = webView.getClass().getMethod("getWhitelist");
   > //                Whitelist whitelist = (Whitelist)gwl.invoke(webView);
   > //                shouldAllowRequest = whitelist.isUrlWhiteListed(source);
   > //            } catch (NoSuchMethodException e) {
   > //            } catch (IllegalAccessException e) {
   > //            } catch (InvocationTargetException e) {
   > //            }
   > //        }`
   > 
   >     str = str.replace(code, commentedOut);
   > 
   >     fs.writeFileSync(file, str, 'utf8');
   > };
   > ```
   
   Hi! thanks for your solution but it isn't working for me :'(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] rolinger commented on issue #345: Cordova 11 > Android incompatible

Posted by "rolinger (via GitHub)" <gi...@apache.org>.
rolinger commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1447170969

   > finally found a plugin for file transfer and it's working!!! https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer
   > 
   > tried and tested
   
   I found that in installed it, it installed clean, but its not working with `cordova-plugin-file-downloader`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1381007463

   `HTTP 401` is a red herring and an incorrect response;
   `FileTransfer.download()` destination must change from oFile.toURL() to oFile.nativeURL.
   
   Protocol/path returned from `toURL()` has changed as inherited from `cordova-file` plugin.
   
   Thanks to https://github.com/sameteyuboglu/cordova-plugin-file-transfer/commit/0c0bd2d65e520674b3ee6210feaab1c373a07f2d as I took that for a spin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] pixellet14 commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
pixellet14 commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1291766359

   > Does not work with Cordova 11 Android; `cordova build android` fails.
   > 
   > Errors due to `cordova-plugin-whitelist` missing.
   > 
   > Include `cordova-plugin-whitelist` and `cordova build android` fails due to an incompatibility with `cordova-plugin-whitelist`.
   
   Have you found a solution yet? if yes then please can you share with me? my project is stuck :'(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] Mugunthan93 commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
Mugunthan93 commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1381422755

   Myself working in Ionic 6 & Capacitor 4,
   
   Give me any solution for this,
   Because of this, I cannot able to publish my application.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] Mister-CK commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
Mister-CK commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1200150078

   I just remove the code that refers to the whitelist plugin with a custom hook. Cordova-anrdoid 10 doesn't use the whitelist plugin anymore so I figure that code has been made redundant.
   Only problem I am having is that the hook is messing up the file. So I might just make a fork and remove the unwanted code myself. Although I prefer a hook.  Sections to be removed:
   `      const firstSectionOfCodeToRemove =
           `import org.apache.cordova.Whitelist;
   `
         const secondSectionOfCodeToRemove =
           `if (shouldAllowRequest == null) {
               try {
                   Method gwl = webView.getClass().getMethod("getWhitelist");
                   Whitelist whitelist = (Whitelist)gwl.invoke(webView);
                   shouldAllowRequest = whitelist.isUrlWhiteListed(source);
               } catch (NoSuchMethodException e) {
               } catch (IllegalAccessException e) {
               } catch (InvocationTargetException e) {
               }
           }``


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] pixellet14 commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
pixellet14 commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1294470392

   finally found a plugin for file transfer and it's working!!!
   https://www.npmjs.com/package/cordova-plugin-ns0m-file-transfer
   
   tried and tested


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] rolinger commented on issue #345: Cordova 11 > Android incompatible

Posted by "rolinger (via GitHub)" <gi...@apache.org>.
rolinger commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1463804490

   For anyone still needing a solution, see this post:
   
   https://github.com/apache/cordova-plugin-file-transfer/issues/339#issuecomment-1450747708
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1292595201

   We do not use Cordova 11 to publish Android due to this issue.
   
   Nice to see some engagement. I will be hands-on here in ~3mths in light of no solution.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] michaelpeterlee commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
michaelpeterlee commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1378195011

   @pieshop Hook did not work for me either.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] opindia123 commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
opindia123 commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1225270953

   @Mister-CK can you share your hook , it will be very helpful, thanks in advance.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file-transfer] pieshop commented on issue #345: Cordova 11 > Android incompatible

Posted by GitBox <gi...@apache.org>.
pieshop commented on issue #345:
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/345#issuecomment-1276441905

   Here is a hook I did:
   
   config.xml:
   `<hook type="after_prepare" src="hooks/hook-android-fix-file-transfer.js" info="Comment out whitelist code" />`
   
   hook-android-fix-file-transfer.js:
   
   ```
   const fs = require('fs-extra');
   const path = require('path');
   
   const DIR = path.join(__dirname, '../');
   
   /**
    * This hook removes whitelist from FileTransfer.java
    * see : https://github.com/apache/cordova-plugin-file-transfer/issues/345
    */
   module.exports = function main(ctx) {
       if (!ctx.opts.platforms.includes('android')) return;
   
       console.log('[hook] Fix file transfer on android');
   
       const file = `${DIR}/platforms/android/app/src/main/java/org/apache/cordova/filetransfer/FileTransfer.java`;
       let code = `import org.apache.cordova.Whitelist;`
       let commentedOut = `//  Commented out by hook-android-fix-file-transfer.js
   //  import org.apache.cordova.Whitelist;`
   
       let str = fs.readFileSync(file, 'utf8');
       str = str.replace(code, commentedOut);
   
       code = `        if (shouldAllowRequest == null) {
               try {
                   Method gwl = webView.getClass().getMethod("getWhitelist");
                   Whitelist whitelist = (Whitelist)gwl.invoke(webView);
                   shouldAllowRequest = whitelist.isUrlWhiteListed(source);
               } catch (NoSuchMethodException e) {
               } catch (IllegalAccessException e) {
               } catch (InvocationTargetException e) {
               }
           }`
       commentedOut = `//  Commented out by hook-android-fix-file-transfer.js
   //          if (shouldAllowRequest == null) {
   //            try {
   //                Method gwl = webView.getClass().getMethod("getWhitelist");
   //                Whitelist whitelist = (Whitelist)gwl.invoke(webView);
   //                shouldAllowRequest = whitelist.isUrlWhiteListed(source);
   //            } catch (NoSuchMethodException e) {
   //            } catch (IllegalAccessException e) {
   //            } catch (InvocationTargetException e) {
   //            }
   //        }`
   
       str = str.replace(code, commentedOut);
   
       fs.writeFileSync(file, str, 'utf8');
   };
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org