Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Cannot GET /_capacitor_file_/data #1876

Closed
gmcaixeta opened this issue Nov 1, 2023 · 2 comments
Closed

bug: Cannot GET /_capacitor_file_/data #1876

gmcaixeta opened this issue Nov 1, 2023 · 2 comments

Comments

@gmcaixeta
Copy link

Bug Report

I migrated from capacitor 3 to capacitor 5.
Now when I try to get a photo that I took from camera using webpath:

 const response = await fetch(photo.webPath!);
 const blob = await response.blob();
 const base64Data = (await convertBlobToBase64(blob)) as string;`

I am getting this error:

Cannot GET /_capacitor_file_/data/user/0/io.ionic.starter/cache/61944.1698760933784.jpeg

I've tried many forms of accessing this path, but when I get the response, I have a GET request error.
It only recognizes via src attribute of "img" html tag. GET request does not work.
Does anything changed on capacitor permission, or something else ?

Plugin(s)

Camera

### Capacitor Version
💊   Capacitor Doctor  💊

 

Latest Dependencies:

 

  @capacitor/cli: 5.5.1
  @capacitor/core: 5.5.1
  @capacitor/android: 5.5.1
  @capacitor/ios: 5.5.1

 

Installed Dependencies:

 

  @capacitor/ios: not installed
  @capacitor/cli: 5.0.5
  @capacitor/android: 5.0.5
  @capacitor/core: 5.0.5

Platform(s)

Android Mobile
Android Studio emulator

Current Behavior

The error occurs when it tries to fetch photo.webPath. As I said it only occurs when I try to access the photoPath as a request. When I use src attribute of "img" html tag, it displays the image.

 const response = await fetch(photo.webPath!);
 const blob = await response.blob();
 const base64Data = (await convertBlobToBase64(blob)) as string;`

Expected Behavior

On capacitor 3 I could get the base64 output correctly.

Code Reproduction

Minimal sample application

https://github.com/Akaori/vue-capacitor-camera

Other Technical Details

"@capacitor-community/barcode-scanner": "^4.0.1",
"@capacitor-community/sqlite": "^5.0.5",
"@capacitor/android": "5.0.5",
"@capacitor/app": "5.0.3",
"@capacitor/camera": "^5.0.7",
"@capacitor/core": "5.0.5",
"@capacitor/haptics": "5.0.4",
"@capacitor/keyboard": "5.0.4",
"@capacitor/status-bar": "5.0.4",
"@ionic/vue": "7.4.3",
"@ionic/vue-router": "7.4.3",
"@types/cypress": "^1.1.3",
"bcryptjs": "^2.4.3",
"core-js": "^3.8.3",
"crypto-browserify": "^3.12.0",
"ionicons": "^7.0.0",
"jeep-sqlite": "^2.3.9",
"moment": "^2.29.4",
"pinia": "^2.1.4",
"typeorm": "^0.3.17",
"vue": "^3.2.13",
"vue-router": "^4.0.3"
@jcesarmobile
Copy link
Member

it's a duplicate of ionic-team/capacitor#7045
the problem is the http plugin, if you disable it then it works

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2023
Copy link

ionitron-bot bot commented Nov 16, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants