[v2] Display an image using the asset protocol. #11498
-
I am trying to display an image using the asset protocol, but I continue to get the error: 403 Forbidden. This is what I have in my tauri.conf.json:
I then followed the example located here: https://tauri.app/reference/javascript/api/namespacecore/#convertfilesrc. If I console.log my assetUrl path, it seems to work. It logs something like "asset://....../image.jpg". Is there a step that I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Try |
Beta Was this translation helpful? Give feedback.
-
@FabianLars I should mention that I primarily develop on Arch Linux. I couldn't get the images to load no matter what process I used -- that is until I switch to Windows for development temporarily. Then suddenly the exact same code would show the images and I wouldn't get any 403 Forbidden errors. So I went back to Linux just to be sure, and sure enough I would get the 403 Forbidden error. Does using the asset protocol in this way only work for Windows? Thanks! |
Beta Was this translation helpful? Give feedback.
yes, it can. i'm not sure how the asset protocol scope is implemented but for the fs scope you have to explicitly add the "hidden" folders (the ones starting with
.
) in the scope paths unless the plugin is configured otherwise viarequireLiteralLeadingDot: false
Edit: This would not be required if you'd use the predefined scope variables btw