简体   繁体   English

使用https的Cordova文件传输插件不适用于Windows

[英]Cordova file transfer plugin using https not working for windows

I am currently using cordova file transfer plugin to download a file and save it locally. 我目前正在使用cordova文件传输插件下载文件并将其保存在本地。 I am using https and the server certificate is installed in the device. 我正在使用https,并且服务器证书已安装在设备中。

It works on IOS and android but it does not work on Windows. 它适用于IOS和android,但不适用于Windows。

I was able to debug up to plugin's code and it would error in this part with the error message of 'A security problem occurred' and would now return to the application with the FTErr.CONNECTION_ERR: 我能够调试插件的代码,它会在这部分出错,并显示错误消息“发生了安全问题”,现在将使用FTErr.CONNECTION_ERR返回到应用程序:

var downloadOperation = download.startAsync();
// update internal TransferOperation object with newly created promise
fileTransferOps[downloadId].promise = downloadOperation;
downloadOperation.then(function () {...}, function(error) 
{
    if (error.message === 'Canceled') {
       resolve(new FTErr(FTErr.ABORT_ERR, source, target, null, null, error));
    } else if (error && error.number === HTTP_E_STATUS_NOT_MODIFIED) {
       resolve(new FTErr(FTErr.NOT_MODIFIED_ERR, source, target, 304, null, error));
    } else {
    // in the other way, try to get response property
        var response = download.getResponseInformation();
        if (!response) {
           resolve(new FTErr(FTErr.CONNECTION_ERR, source, target));
        } 
    }
}

This is my code in cordova: 这是我在科尔多瓦的代码:

fileTransfer.download(uri, fileURL, function (entry) {
    console.log('file download successful');
}, function (errorMsg) {
    console.log(errorMsg);
}, false, {
    headers: {"Authorization": authToken},
});`

Is there anything I am missing to make this work in windows? 在Windows中使我无法正常工作吗?

Just to add, download using http was working. 只是添加,使用http下载是有效的。 Https certificate is also valid since ajax get worked. 自从ajax开始工作以来,Https证书也是有效的。

Thanks! 谢谢!

From MSDN, client certificate is not supported by the BackgroundDownloader. 从MSDN,BackgroundDownloader不支持客户端证书。 https://social.msdn.microsoft.com/Forums/en-US/c25146d2-c051-4367-9745-2b526618dc35/winjsxhr-and-httpclient-work-with-client-certificates-backgrounddownloader-doesnt?forum=winappswithhtml5 https://social.msdn.microsoft.com/Forums/en-US/c25146d2-c051-4367-9745-2b526618dc35/winjsxhr-and-httpclient-work-with-client-certificates-backgrounddownloader-doesnt?forum=winappswithhtml5

So I guess the only way for now would be to create a plugin that uses HttpClient. 因此,我想现在唯一的方法就是创建一个使用HttpClient的插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用cordova插件文件传输下载进度事件在ios中不起作用 - Download progress event is not working in ios using cordova plugin file transfer cordova-plugin-file-transfer插件在Windows 10 sencha touch store应用程序上不起作用 - cordova-plugin-file-transfer plugin not working on Windows 10 sencha touch store app Cordova文件传输插件的IONIC错误 - IONIC Error with Cordova file-transfer plugin 错误代码1 Cordova插件文件传输Android - Error code 1 cordova plugin file transfer android Windows 8使用Cordova的本机插件 - Native Plugin For Windows 8 Using Cordova cordova-plugin-file-transfer:如何使用签名的URL将文件上传到S3? - cordova-plugin-file-transfer: How do you upload a file to S3 using a signed URL? 在cordova项目中,我正在使用文件传输插件上传个人资料照片,它始终返回Code 1错误? - In cordova project I am using file transfer plugin to upload a profile photo it always returns Code 1 error? 从cordova文件传输插件上传文件到nodeJS服务器 - upload file from cordova file transfer plugin to nodeJS server 图片未使用Cordova文件传输Android上传 - Image not uploaded using cordova file transfer android 如何从Cordova文件传输插件获取mimeType? - How to get mimeType from Cordova File Transfer Plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM