jony89 commented on issue #235: CB-14181: (android) Fix bug - Cannot read property 'filesystemName' of null
URL: https://github.com/apache/cordova-plugin-file/pull/235#issuecomment-401337457
@jcesarmobile it has been reproduced to me constantly on android emulator nexus 5
device - nexus 5
android 7.1.1 nougat (yet will be reproduced on oreo as well I'm sure)
cordova 7.1.0
with the following code from the blog - documentation (caused on the line `fs.root.getFile`
```js
window.requestFileSystem(window.LocalFileSystem.TEMPORARY, 0, (fs) => {
console.log('file system open: ' + fs.name);
fs.root.getFile(
`${window.cordova.file.applicationStorageDirectory}${this.fileName}`,
{ create: true, exclusive: false }
, (fileEntry) => {
console.log('fileEntry is file? ' + fileEntry.isFile.toString());
var oReq = new XMLHttpRequest();
// Make sure you add the domain name to the Content-Security-Policy <meta> element.
oReq.open('GET', cvURL, true);
// Define how you want the XHR data to come back
oReq.responseType = 'blob';
oReq.onload = (oEvent) => {
var blob = oReq.response; // Note: not oReq.responseText
if (blob) {
// Create a URL based on the blob, and set an <img> tag's src to it.
var url = window.URL.createObjectURL(blob);
document.getElementById('bot-img').src = url;
// Or read the data with a FileReader
var reader = new FileReader();
reader.addEventListener('loadend', () =>
{
// reader.result contains the contents of blob as text
}
);
reader.readAsText(blob);
} else console.error('we didnt get an XHR response!');
};
oReq.send(null);
}, function (err)
{ console.error('error getting file! ' + err); }
);
}, function (err)
{ console.error('error getting persistent fs! ' + err); }
);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
The PR makes sense, but how can it be reproduced?