cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

NOT_FOUND_ERR when share as an attachment from Office Word

Open hydrococcous opened this issue 5 years ago • 3 comments

Bug Report

NOT_FOUND_ERR on resolveLocalFilesystemUrl respectively copyFile

Problem

I'm trying to share a document from the microsoft office app on Android in my app. In my app, I get an intent (cordova-plugin-webintent) back with the path to the document.

content://com.microsoft.office.word.fileprovider/3b683438-3900-4097-afe3-d654bd46c123/Document.docx

i use the Plugin cordova-plugin-filepath to change this Path to:

file:///data/user/0/com.microsoft.office.word/files/tempOffice/Share/57232792-4ca0-42c2-89a9-33888f9576be/Document.docx

Regardless of which of the two paths I use, in both cases I get a NOT_FOUND_ERR back.

Is there a Problem with access to files from Microsoft Apps?

Environment, Platform, Device

Ionic:

Ionic CLI : 5.4.2 Ionic Framework : ionic-angular 3.9.5 @ionic/app-scripts : 3.2.3

Cordova:

Cordova CLI : 8.1.1 ([email protected]) Cordova Platforms : android 7.1.4 Cordova Plugins : no whitelisted plugins (34 plugins total)

Utility:

cordova-res : 0.7.0 native-run : 0.2.8

System:

Android SDK Tools : 26.1.1 (C:\Users\username\AppData\Local\Android\sdk) NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe) npm : 6.9.0 OS : Windows 10

hydrococcous avatar Nov 27 '19 08:11 hydrococcous

Bug Report

NOT_FOUND_ERR on resolveLocalFilesystemUrl respectively copyFile

Problem

I'm trying to share a document from the microsoft office app on Android in my app. In my app, I get an intent (cordova-plugin-webintent) back with the path to the document.

content://com.microsoft.office.word.fileprovider/3b683438-3900-4097-afe3-d654bd46c123/Document.docx

i use the Plugin cordova-plugin-filepath to change this Path to:

file:///data/user/0/com.microsoft.office.word/files/tempOffice/Share/57232792-4ca0-42c2-89a9-33888f9576be/Document.docx

Regardless of which of the two paths I use, in both cases I get a NOT_FOUND_ERR back.

Is there a Problem with access to files from Microsoft Apps?

Environment, Platform, Device

Ionic:

Ionic CLI : 5.4.2 Ionic Framework : ionic-angular 3.9.5 @ionic/app-scripts : 3.2.3

Cordova:

Cordova CLI : 8.1.1 ([email protected]) Cordova Platforms : android 7.1.4 Cordova Plugins : no whitelisted plugins (34 plugins total)

Utility:

cordova-res : 0.7.0 native-run : 0.2.8

System:

Android SDK Tools : 26.1.1 (C:\Users\username\AppData\Local\Android\sdk) NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe) npm : 6.9.0 OS : Windows 10

I am having the same serious issue. I suspect this has to do with android 8 & permission.

Any solution?

anahvictoronyedic avatar Aug 20 '20 18:08 anahvictoronyedic

The path file:///data/user/0/com.microsoft.office.word/... definitely won't work... this directory is private to the application. Only the com.microsoft.office.world application can access this directory.

A sample reproduction app may help move this issue further.

breautek avatar Aug 20 '20 19:08 breautek

Bug Report

NOT_FOUND_ERR on resolveLocalFilesystemUrl respectively copyFile

Problem

I'm trying to share a document from the microsoft office app on Android in my app. In my app, I get an intent (cordova-plugin-webintent) back with the path to the document.

content://com.microsoft.office.word.fileprovider/3b683438-3900-4097-afe3-d654bd46c123/Document.docx

i use the Plugin cordova-plugin-filepath to change this Path to:

file:///data/user/0/com.microsoft.office.word/files/tempOffice/Share/57232792-4ca0-42c2-89a9-33888f9576be/Document.docx

Regardless of which of the two paths I use, in both cases I get a NOT_FOUND_ERR back. Is there a Problem with access to files from Microsoft Apps?

Environment, Platform, Device

Ionic: Ionic CLI : 5.4.2 Ionic Framework : ionic-angular 3.9.5 @ionic/app-scripts : 3.2.3 Cordova: Cordova CLI : 8.1.1 ([email protected]) Cordova Platforms : android 7.1.4 Cordova Plugins : no whitelisted plugins (34 plugins total) Utility: cordova-res : 0.7.0 native-run : 0.2.8 System: Android SDK Tools : 26.1.1 (C:\Users\username\AppData\Local\Android\sdk) NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe) npm : 6.9.0 OS : Windows 10

I am having the same serious issue. I suspect this has to do with android 8 & permission.

Any solution?

@breautek

My case was different.

For some reason, I used my colleagues smartphone running android 8.

I needed to pick a file using https://github.com/don/cordova-filechooser/ after getting the fileurl to the selected file, call to *resolveLocalFilesystemUrl * returns NOT_FOUND_ERR for some files only. The undefined behavior was too difficult to tackle because some files selected and some could not select.

I had to check the source code but could not figure out while some files resulted to not found. https://github.com/apache/cordova-plugin-file/blob/ce4bfa1b9c0cfdb3e8e479a62ea41a41c7c7b53e/www/resolveLocalFileSystemURI.js#L80

I saw a recommendation to request android permission at runtime, but could not help much.

Due of the deadline on me, I then tried using another chooser plugin https://github.com/cyph/cordova-plugin-chooser.

But I still prefer the first plugin for smaller memory allocation when picking files.

This is a silent problem that don't show up everytime.

anahvictoronyedic avatar Aug 21 '20 12:08 anahvictoronyedic