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

resolveLocalFileSystemURL: incorrect filename

Open vtalas opened this issue 6 years ago • 3 comments

I have an email with attachment - let's say info.txt there is an intent handler which is ment to open the attachment in the Android app
I'm using the resolveLocalFileSystemURL to read the file, the url is in format like:

"content://com.google.android.gm.sapi/[email protected]/message_attachment_external/%23thread-a%3Ar-5057787201526387426/%23msg-a%3Ar-7956362123961253525/0.1?account_type=com.google&mimeType=application%2Foctet-stream&rendition=1"

FileEntry returned from the resolveLocalFileSystemURL contains incorrect name ("0.1") e.g:

{
  fullPath: "/com.google.android.gm.sapi/[email protected]/message_attachment_external/#thread-a:r-5057787201526387426/#msg-a:r-7956362123961253525/0.1"
  isDirectory: false
  isFile: true
  name: "0.1"
  nativeURL: "content://com.google.android.gm.sapi/[email protected]/message_attachment_external/%23t
}

I'd expect the info.txt instead of the 0.1

vtalas avatar Oct 15 '18 07:10 vtalas

I have an email with attachment - let's say info.txt there is an intent handler which is ment to open the attachment in the Android app I'm using the resolveLocalFileSystemURL to read the file, the url is in format like:

"content://com.google.android.gm.sapi/[email protected]/message_attachment_external/%23thread-a%3Ar-5057787201526387426/%23msg-a%3Ar-7956362123961253525/0.1?account_type=com.google&mimeType=application%2Foctet-stream&rendition=1"

FileEntry returned from the resolveLocalFileSystemURL contains incorrect name ("0.1") e.g:

{
  fullPath: "/com.google.android.gm.sapi/[email protected]/message_attachment_external/#thread-a:r-5057787201526387426/#msg-a:r-7956362123961253525/0.1"
  isDirectory: false
  isFile: true
  name: "0.1"
  nativeURL: "content://com.google.android.gm.sapi/[email protected]/message_attachment_external/%23t
}

I'd expect the info.txt instead of the 0.1

Did you find a solution to this?

magnus16 avatar Jul 16 '20 17:07 magnus16

I had the same problem and used https://github.com/mobius3/cordova-plugin-filename as a workaround to get the correct filename and it's working so far.

rockkiska avatar Aug 25 '20 10:08 rockkiska

Thank you @rockkiska for linking to that plugin! I struggled for a long time to find a solution

EmmanuelJego avatar Sep 13 '21 22:09 EmmanuelJego