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 2019/09/25 07:30:43 UTC

[GitHub] [cordova-plugin-file-transfer] Digital-Chen opened a new issue #242: iOS: Download encounters "Invalid Server URL" if source file path contains non-English characters

Digital-Chen opened a new issue #242: iOS: Download encounters "Invalid Server URL" if source file path contains non-English characters
URL: https://github.com/apache/cordova-plugin-file-transfer/issues/242
 
 
   # Bug Report
   
   ## Problem
   File Transfer reports error when attempting to download a remote file with non-EN characters in the path/name. The file can be opened in browser with no issue. 
   
   ### What is expected to happen?
   Should download correctly regardless of the name.
   
   
   ### What does actually happen?
   File Transfer Error: Invalid server URL https://xxxxxxxxx/SOME CHINESE CHARACTERS.pdf
   
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   I am using this in combination with Ionic 4. 
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   `downloadRemoteFile(downloadUrl, path, fileName){
         const transfer = this.ft.create();
         transfer.download(downloadUrl, path + fileName, true).then(entry => {
           let url = entry.toURL();
           this.openFileByPlatform(url);
         },(err) => {
           alert('download error');
         }); 
       }`
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Only happens on iOS devices (tested on iOS 12+). Android is fine.
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   "@ionic/core": "^4.8.0",
   "cordova-ios": "4.5.5",
   "cordova-plugin-file-transfer": "1.7.1",
   "@ionic-native/file-transfer": "^5.0.0",
   
   ### Workaround
   Currently I need to modify the following line in CDVFileTransfer.m to fix the issue.
   LINE 452: 
   Original:
   `NSURL* sourceURL = [NSURL URLWithString:source];`
   Modified:
   `NSURL* sourceURL = [NSURL URLWithString:[source stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];`
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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