Closed felipejncc closed 3 years ago
Interesting! I have only tested this with FilesystemDirectory.Data
, so I will need to have a look at this.
Does it work if you use Filesystem.writeFile
instead?
This is the error:
2020-08-01 04:59:17.317 32318-9786/com.app E/Capacitor/BlobWriter: failed to move file into place
Possibly a permissions issue?
It doesn't work with Filesystem.writeFile
neither and it is due to a permissions issue.
I think, when the option path
is set to an absolute url, Filesystem has those issues in android, even if the permission was granted.
Regards!
Hmm! If you get the time, could you please create an issue with capacitor? When it is fixed for Filesystem.writeFile
, I will copy their solution for this plugin.
Of course. I'll be doing the corresponding tests for submit the issue with all the necessary info.
It doesn't work with
Filesystem.writeFile
neither and it is due to a permissions issue.I think, when the option
path
is set to an absolute url, Filesystem has those issues in android, even if the permission was granted.Regards!
In my case, this works with Filesystem.writeFile where this plugin fails. So I am pretty sure it has to be fixed here first.
I will send a PR if i could find the root issue.
@thesayyn That would be much appreciated!
# I'm getting the error Error: unexpected HTTP status when trying to write any file on Android. I've used the instructions to install the plugin, but I'm not able to find what i'm doing wrong...
this is my code:
where
${name}
is 3b4eaae1-a855-4161-9fd3-d0fe165dd27a.pdf andfile
is a Blob which was obtained via http request.Also, the directory archives was created at the app initialization.
I'm using: @capacitor/android 2.2.1 @capacitor/core 2.2.1 @capacitor/ios 2.2.1 ionic 5 angular 8 android emulator (Android 11, API 30)
In iOS works fine.
This is what I get in Chrome's console:
Error: unexpected HTTP status at Module. (plugin.esm.js:73)
at Generator.next ()
at fulfilled (plugin.esm.js:21)
at ZoneDelegate.invoke (zone-evergreen.js:364)
at Zone.run (zone-evergreen.js:123)
at zone-evergreen.js:857
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Zone.runTask (zone-evergreen.js:167)
at drainMicroTaskQueue (zone-evergreen.js:569)
And This is what I get in logcat:
2020-08-01 04:59:05.688 32318-32527/com.app V/Diagnostic: Get authorisation status for android.permission.READ_EXTERNAL_STORAGE 2020-08-01 04:59:05.731 32318-32527/com.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 29820049, pluginId: BlobWriter, methodName: getConfig 2020-08-01 04:59:05.731 32318-32527/com.app V/Capacitor: callback: 29820049, pluginId: BlobWriter, methodName: getConfig, methodData: {} 2020-08-01 04:59:05.755 32318-32527/com.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 29820050, pluginId: Filesystem, methodName: getUri 2020-08-01 04:59:05.756 32318-32527/com.app V/Capacitor: callback: 29820050, pluginId: Filesystem, methodName: getUri, methodData: {"path":"archives\/3b4eaae1-a855-4161-9fd3-d0fe165dd27a.pdf","directory":"EXTERNAL"} 2020-08-01 04:59:05.867 32318-9786/com.app D/Capacitor/BlobWriter: OPTIONS /storage/emulated/0/Android/data/com.app/files/archives/3b4eaae1-a855-4161-9fd3-d0fe165dd27a.pdf 2020-08-01 04:59:06.965 32318-9786/com.app D/Capacitor/BlobWriter: PUT /storage/emulated/0/Android/data/com.app/files/archives/3b4eaae1-a855-4161-9fd3-d0fe165dd27a.pdf 2020-08-01 04:59:17.317 32318-9786/com.app E/Capacitor/BlobWriter: failed to move file into place 2020-08-01 04:59:17.335 32318-32318/com.app E/Capacitor/Console: File: http://192.168.1.74:8100/main.js - Line 12848 - Msg: Error: unexpected HTTP status